未捕获的错误:[$喷油器:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr [英] Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr
问题描述
以下是错误消息我得到了code我写。我不得不提到的错误消息后,code。我是新的,需要帮助!
未捕获的SyntaxError:意外的标记{angular.min.js:6
未捕获的错误:[$喷油器:modulerr]
的http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=mainApp&p1=Error%3A…A%2F%2Flocalhost%3A8084%2FAngularProject%2FLib%2Fangular.min.js%3A19%3A339)(anonymous
功能)@ angular.min.js:6(匿名函数)@ angular.min.js:38米
@ angular.min.js:7克@ angular.min.js:37eb @ angular.min.js:40D @
angular.min.js:19Ac @ angular.min.js:20Zd @
angular.min.js:18(匿名函数)@ angular.min.js:289A @
angular.min.js:176C @ angular.min.js:35
块引用><脚本SRC =库/ angular.min.js类型=文/ JavaScript的>< / SCRIPT>
<脚本SRC =库/角route.js类型=文/ JavaScript的>< / SCRIPT>
<脚本>
变种demoApp = angular.module('mainApp',[ngRoute]); demoApp.config(函数($ routeProvider){
$ routeProvider
。什么时候('/',
{
控制器:'SimpleController',
templateUrl:view1.html
})
。当('/厂景',{
控制器:'SimpleController',
templateUrl:'/ view.html
})
不然的话({redirectTo:'/'});
}); demoApp.controller('SimpleController',函数($范围){
$ scope.customers = [
{名称:'乔',城市:多伦多},
{名称:'简',城市:'悉尼'},
{名:罗伯托,城市:'维也纳'},
{名称:'久美子',城市:'日本'}
]; $ scope.addCustomer = funtion(){
$ scope.customers.push({名:$ scope.newCustomer.name,城市:$ scope.newCustomer.city});
};
}); / *
功能SimpleController($范围){
$ scope.customers = [
{名:萨宾,城市:巴克塔普尔},
{名称:'ABHI,城市:勒利德布尔},
{名称:'SHREE,城市:加德满都},
{名称:'rameshwor,城市:'的Bhojpur'}
];
} * /
< / SCRIPT>
解决方案
ngRoute
应该用引号括起来:VAR demoApp = angular.module('mainApp',['ngRoute']);
Below is the error message i get for the code i have written. I have mention the code after the error message. I am new and need help!!
Uncaught SyntaxError: Unexpected token {angular.min.js:6
Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr?p0=mainApp&p1=Error%3A…A%2F%2Flocalhost%3A8084%2FAngularProject%2FLib%2Fangular.min.js%3A19%3A339)(anonymous function) @ angular.min.js:6(anonymous function) @ angular.min.js:38m @ angular.min.js:7g @ angular.min.js:37eb @ angular.min.js:40d @ angular.min.js:19Ac @ angular.min.js:20Zd @ angular.min.js:18(anonymous function) @ angular.min.js:289a @ angular.min.js:176c @ angular.min.js:35"
<script src="Lib/angular.min.js" type="text/javascript"></script> <script src="Lib/angular-route.js" type="text/javascript"></script> <script> var demoApp=angular.module('mainApp',[ngRoute]); demoApp.config(function($routeProvider){ $routeProvider .when('/', { controller:'SimpleController', templateUrl:'view1.html' }) .when('/view1',{ controller:'SimpleController', templateUrl:'/view.html' }) .otherwise({redirectTo:'/'}); }); demoApp.controller('SimpleController',function($scope){ $scope.customers=[ {name:'Joe',city:'Toronto'}, {name:'Jane',city:'Sydney'}, {name:'Roberto',city:'Vienna'}, {name:'Kumiko',city:'Japan'} ]; $scope.addCustomer=funtion(){ $scope.customers.push({name:$scope.newCustomer.name,city:$scope.newCustomer.city}); }; });/* function SimpleController($scope){ $scope.customers=[ {name:'Sabin',city:'Bhaktapur'}, {name:'Abhi',city:'Lalitpur'}, {name:'shree',city:'Kathmandu'}, {name:'rameshwor',city:'Bhojpur'} ]; }*/ </script>
解决方案
ngRoute
should be in quotes:var demoApp=angular.module('mainApp',['ngRoute']);
这篇关于未捕获的错误:[$喷油器:modulerr] http://errors.angularjs.org/1.4.3/$injector/modulerr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!