0

Is there anyone know why I got the following issue:

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.3.6/$injector/modulerr?p0=helloKinveyApp&p1=E…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.3.6%2Fangular.min.js%3A17%3A350)angular.min.js:6 (anonymous function)angular.min.js:36 (anonymous function)angular.min.js:7 rangular.min.js:35 gangular.min.js:38 Obangular.min.js:17 dangular.min.js:18 scangular.min.js:16 Hdangular.min.js:249 (anonymous function)angular.min.js:163 aangular.min.js:32 c

var app = angular.module("helloKinveyApp", ["ngRoute", "kinvey"]);

app.run(["$kinvey", function($kinvey) {
    var promise = $kinvey.init({
       appKey: clientParams.appKey
        , appSecret: clientParams.appSecret
    });

    promise.then(function() {
        console.log("Kinvey init with success");
    }, function(errorCallback) {
        console.log("Kinvey init with error: " + JSON.stringify(errorCallback));
    });
}]);

<!DOCTYPE html>
<html data-ng-app="helloKinveyApp">
    <head>
        <title>Hello Kinvey Lesson 1</title>
    </head>
    <body>
        <div data-ng-view="" />
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-route.min.js"></script>
        <script src="https://da189i1jfloii.cloudfront.net/js/kinvey-angular-1.1.4.min.js"></script>
    </body>
</html>
Dave Chen
  • 10,887
  • 8
  • 39
  • 67
newbie
  • 79
  • 1
  • 7
  • use non-minified version of angular, you would get more details about the issue – harishr Dec 11 '14 at 09:06
  • In what section of your application is the following line located `var app = angular.module("helloKinveyApp", ["ngRoute", "kinvey"]);`? – Igwe Kalu Dec 11 '14 at 09:08
  • And what is _jQuery_ tag doing here? – Regent Dec 11 '14 at 09:08
  • may be you are not including the js file in which module is defined? – A.B Dec 11 '14 at 09:09
  • Put kinvey.js load above the angular.js file load – Ben Diamant Dec 11 '14 at 09:09
  • Below is the detail of exception Uncaught Error: [$injector:modulerr] Failed to instantiate module helloKinveyApp due to: Error: [$injector:nomod] Module 'helloKinveyApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. – newbie Dec 11 '14 at 09:17
  • @BenDiamant, why should kinvey be above angular? His app module definition rather should be below both angular and kinvey. – Igwe Kalu Dec 11 '14 at 09:26

1 Answers1

0

If your code was structured in a manner similar as below, it SHOULD work (i.e. you should get a module load error):

...
<body>
    ...
    <div data-ng-view="" />
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js">
    </script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-route.min.js">
    </script>
    <script src="https://da189i1jfloii.cloudfront.net/js/kinvey-angular-1.1.4.min.js">
    </script>
    ...
    <script>
        var app = angular.module("helloKinveyApp", ["ngRoute", "kinvey"]);

        app.run(["$kinvey", function($kinvey) {
            var promise = $kinvey.init({
               appKey: clientParams.appKey,
               appSecret: clientParams.appSecret
            });

            promise.then(function() {
                console.log("Kinvey init with success");
            }, function(errorCallback) {
                console.log("Kinvey init with error: " + JSON.stringify(errorCallback));
            });
        }]);
    </script>
</body>
Igwe Kalu
  • 14,286
  • 2
  • 29
  • 39