我有一個問題,角JS接收到一個錯誤:未捕獲的錯誤:[$注射器:modulerr]。我的JS文件看起來
這是我的應用程序的js
var app = angular.module(' myApp', ['ngRoute']);
app.config(["$routeProvider", function($routeProvider) {
$routeProvider
.state('home', {
url: '/home',
abstract: true,
templateUrl: 'templates/home.html',
controller: 'homeCtrl'
});
otherwise('/home');
}]);
這是我的索引頁
<div ng-app="myApp">
<div ng-view></div>
</div>
<script src="js/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular-route.min.js"></script>
<script type="text/javascript" src="lib/controller.js"></script>
<script type="text/javascript" src="lib/app.js"></script>
<script type="text/javascript" src="lib/directives.js"></script>
這是我的控制器JS
var app = angular.module('myApp',[]);
app.controller('homeCtrl', function($scope)
{
$scope.names = [{nickname:'n',fullname:'nakama'}];
});
,這是我的主頁
<div>
<ul>
<li ng-repeat="x in names">
{{x.nickname + '<-means->' + x.fullname}}
</li>
</ul>
</div>
你'controller.js' – CozyAzure
感謝花花公子CozyAzure它的工作 – Bhautik