angularjs – 未捕获错误:[$injector:modulerr]无法在Apache上
发布时间:2020-12-17 07:29:44 所属栏目:安全 来源:网络整理
导读:我正在使用Apache服务器来托管一个角度应用程序. 这是index.html: html head script src="/lib/angular/angular.js" /head script myapp = angular.module('myapp',[]); myapp.controller('indexCtrl',function($scope){ $scope.words = ['It','is','what',
我正在使用Apache服务器来托管一个角度应用程序.
这是index.html: <html> <head> <script src="/lib/angular/angular.js"> </head> <script> myapp = angular.module('myapp',[]); myapp.controller('indexCtrl',function($scope){ $scope.words = ['It','is','what','it','is'] }); </script> <body ng-app="myapp"> <div ng-controller="indexCtrl"> <div ng-repeat="word in words"> {{word}} </div> </div> </body> </html> 当我从浏览器点击html时,它会显示一个包含此错误的空白页:
可能有什么不对?
该错误是由于数组内的重复值.我在ng-repeat中添加了$index索引来解决这个问题.
DOCS:ng-repeat 修改后的代码 <html> <head> <script src="/lib/angular/angular.js"></script> </head> <script> var myapp = angular.module('myapp','is'] }); </script> <body ng-app="myapp"> <div ng-controller="indexCtrl"> <div ng-repeat="word in words track by $index"> {{word}} </div> </div> </body> </html> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |