我需要一些幫助的人。只需要學習角度,我就是這樣設置自己的。錯誤:[ng:areq] http://errors.angularjs.org/1.2.25/ng/areq?
這是我的文件結構。
AboutController.js
function AboutController($scope){
$scope.data = {
"data" : {
"name" : "nameku",
"email" : "email.com"
},
"data" : {
"name" : "nameku2",
"email" : "email2.com"
}
}
}
about.html
<script type="text/javascript" src="controllers/AboutController.js"></script>
<div ng-controller="AboutController">
<ul ng-repeat="d in data">
<li>{{d.name}}</li>
</ul>
</div>
的index.html
<html ng-app="TestingAngular">
<head>
<title>TestingAngular Dashboard</title>
</head>
<script type="text/javascript" src="components/angular/angular.min.js"></script>
<script type="text/javascript" src="components/angular-route/angular-route.min.js"></script>
<script type="text/javascript" src="route.js"></script>
<body>
<div ng-view></div>
</body>
</html>
route.js
angular.module('TestingAngular', ['ngRoute'])
.config(function($routeProvider){
$routeProvider
.when(
'/about' , {templateUrl: 'views/about.html'}
)
.when(
'/contact' , {templateUrl: 'views/contact.html'}
)
.when(
'/' , {templateUrl: 'views/home.html'}
);
});
我的問題是我得到這個錯誤。有沒有辦法,我希望它可以工作?
當我移動
<script type="text/javascript" src="controllers/AboutController.js"></script>
的指數,它會工作。請糾正我,如果我在錯誤的道路很
錯誤:[NG:AREQ] http://errors.angularjs.org/1.2.25/ng/areq?p0=AboutController&p1=not%20aNaNunction%2C%20got%20undefined 在錯誤(原生)
試圖聲明您的控制器'angular.module( 'TestingAngular')。控制器( 'AboutController',函數($ scope){});' – akn 2014-09-19 06:41:20