我正在从视频教程中学习angularjs的婴儿步骤,当我到达控制器部分时,我遇到了这个错误:
Argument' SimpleController'不是一个功能,未定义
虽然我仔细地按照步骤操作。请记住这是迄今为止我对angularjs的所有了解。
<!DOCTYPE html>
<html data-ng-app="">
<head></head>
<body>
<div data-ng-controller="SimpleController">
<input type="text" data-ng-model="name" id=""> {{ name }}
<br>
<h3>Looping with the ng-repeat Directive</h3>
<ul>
<li data-ng-repeat="cutomer in customers | filter:name | orderBy:'city'">{{ cutomer.name | uppercase }} - {{ cutomer.city | lowercase }}</li>
</ul>
</div>
<script src="angular.min.js"></script>
<script>
function SimpleController($scope) {
$scope.customers = [
{name:'Yasser Moussa',city:'Alexandria'},
{name:'Ahmed Salah',city:'Al Riyadh'},
{name:'Khaled Medhat',city:'Alexandria'},
{name:'Ali Dawood',city:'Cairo'}
];
}
</script>
</body>
</html>
答案 0 :(得分:1)
angular.module("app", []).controller("SimpleController, function() {})
data-ng-app="app"
这是plunker