javascript - Angular JS, 'nomod',Module '{0}' is not available! You either misspelled -
this code in index.html
<html ng-app=""> <head> <link rel="stylesheet" href="css/app.css"> <link rel="stylesheet" href="css/bootstrap.css"> <script src="lib/angular/angular.js"></script> <script src="js/phonecontrollers.js"></script> <title ng-bind-template="google phone gallery:{{query}}">google phone gallery</title> </head> <body ng-controller="phonelistctrl"> <div class="container-fluid"> <div class="row-fluid"> <div class="span2"> search: <input ng-model="query"> sory by: <select ng-model="orderprop"> <option value="name">alphabetical</option> <option value="age">newest</option> </select> </div> <div class="span10"> <h1>{{hello}}</h1> <p>total number of phones:{{filtered.length}}</p> <ul class="phones"> <li ng-repeat="phone in filtered=(phones | filter:query | orderby:orderprop)" class="thumbnail"> <span>{{$index}}</span> <a href="#/phones/{{phone.id}}" class="thumb"><img ng-src="{{phone.imageurl}}" /></a> <a href="#/phones/{{phone.id}}">{{phone.name}}</a> <p>{{phone.snippet}}</p> </li> </ul> </div> </div> </div> <div id="currentfilter">current filter: {{query}}</div> <div id="currentorderprep">current order: {{orderprop}}</div> <!--<div>{{phones|json}}</div>--> </body> </html>
when open chrome web inspector, throws this:
return ensure(modules, name, function() { if (!requires) { throw $injectorminerr('nomod', "module '{0}' not available! either misspelled " + "the module name or forgot load it. if registering module ensure " + "specify dependencies second argument.", name); }
and phonecontrollers.js:
function phonelistctrl($scope, $http) { $http.get('phones/phones.json').success(function (data) { $scope.phones = data; }); $scope.orderprop = "age"; };
but when closing chrome web inspector, ran smoothly. tell me happens? in advance
i read angular.js code, seems angular bug, whenever, error thrown.
var $injectorminerr = minerr('$injector'); var ngminerr = minerr('ng'); function ensure(obj, name, factory) { return obj[name] || (obj[name] = factory()); } var angular = ensure(window, 'angular', object); // need expose `angular.$$minerr` modules such `ngresource` reference during bootstrap angular.$$minerr = angular.$$minerr || minerr; return ensure(angular, 'module', function() { /** @type {object.<string, angular.module>} */ var modules = {}; return function module(name, requires, configfn) { var assertnothasownproperty = function(name, context) { if (name === 'hasownproperty') { throw ngminerr('badname', 'hasownproperty not valid {0} name', context); } }; assertnothasownproperty(name, 'module'); if (requires && modules.hasownproperty(name)) { modules[name] = null; } return ensure(modules, name, function() { if (!requires) { throw $injectorminerr('nomod', "module '{0}' not available! either misspelled " + "the module name or forgot load it. if registering module ensure " + "specify dependencies second argument.", name); }
the variable requires never defined. i'm fresher, mistake, please tell me.
i have link angularjs documentation
which says module should defined as:
angular.module('myapp',[]);
Comments
Post a Comment