javascript - AngularJS Failing to Instantiate Module -


for reason, angularjs module isn't loading correctly. pretty new , i've read lot of tutorials, can't seem working.

[17:22:36.338] error: [$injector:modulerr] failed instantiate module wc2013mongomod due to: [$injector:nomod] module 'wc2013mongomod' not available! either misspelled module name or forgot load it. if registering module ensure specify dependencies second argument.

i have found question, appears close description problem: angularjs: uncaught error: [$injector:modulerr] failed instantiate module?

it suggests re-arranging order in scripts included. i've tried put scripts @ end of body, no luck. i've tried put them inside <head> element, still no luck. doing wrong here?

i using jade, resulting html looks this:

<!doctype html> <html ng-app="wc2013mongomod">    <head>       <title>world cup 2014 mongodb experiment project</title>       <link rel="stylesheet" href="/stylesheets/style.css">       <script src="js/angular/angular.js"></script><script src="js/main.js"></script>    </head>    <body>       <h1>world cup 2014 mongodb experiment project</h1>       <p>welcome world cup 2014 mongodb experiment project</p>       <div ng-controller="teamctrl">          <p>angular js controller</p>       </div>    </body> </html> 

the javascript looks this:

console.log("loaded main.js");  var myapp = angular.module('wc2014mongomod',[]);  myapp.service('teamservice', function($http) {         //delete $http.defaults.headers.common['x-requested-with'];         this.getdata = function(callbackfunc) {                 $http({                         method: 'get',                         url: '/api'                         //params: 'limit=10, sort_by=created:desc',                         //headers: {'authorization': 'token token=xxxxyyyyzzzz'}                 }).success(function(data){                         // data succesfully returned, call our callback                         //callbackfunc(data);                         console.log("data received");                         console.log(data);                 }).error(function(){                         alert("error");                 });         } });  myapp.controller('teamctrl', function($scope, teamservice) {         $scope.data = null;         console.log("we're in controller");         teamservice.getdata(function(dataresponse) {                 $scope.data = dataresponse;         }); }); 

check difference. 2013 vs 2014.

<html ng-app="wc2013mongomod"> 

and

var myapp = angular.module('wc2014mongomod',[]); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -