Integrating apollo-client with angular JS application

Viewed 433

I tried integrating apollo-client into my angular application and it worked wonderfully.

However, my manager asked to call the GraphQL server from our prototype application called 'protoApp' which was built in Angular1. So I followed your documentation in https://github.com/apollographql/angular1-apollo

  1. I did npm install angular1-apollo apollo-client --save . I could see the angular1-appolo, apollo-client, graphql-tag modules under node_modules.

  2. Now, when i add 'angular-apollo' as a dependency into my app module, it is failing when i ran this application -

    (function () {
        'use strict';
        var apolloAng = require('angular-apollo');
        angular.module('protoApp', [
            'ngAnimate',
            'ngResource',
            'ui.router',       
            'anugular1-apollo'
        ]);
    })();
    

In the browser, i am seeing

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=CompassApp&p1=Error…0yc%20(http%3A%2F%2F127.0.0.1%3A9090%2Fscripts%2Fangular.min.js%3A21%3A332)

I tried first requiring the module using require('angualr-apollo') and then injecting into angular module , i am seeing Uncaught ReferenceError: require is not defined

  1. How to add import statements when defining default client when i have to import gql from graphql-tag, as import statements are not working in my angular1 application.
0 Answers
Related