【发布时间】:2014-07-22 18:19:49
【问题描述】:
我一直在关注一个教程,教科书向我保证这是可行的,但它正在轰炸
错误:[ng:areq] 参数“SimpleController”不是函数,得到 未定义
为什么?我已经对它进行了棉绒,上下颠簸,我看不出有什么问题。为什么 SimpleController 出现未定义?
<html ng-app>
<head>
<title>
</title>
</head>
<body>
<input type="text" ng-model="blah" />
<div ng-controller="SimpleController">
<h3>looping a data set</h3>
<ul>
<li ng-repeat="cust in customers | filter:blah | orderBy:'city'">
{{cust.name | uppercase}} - {{cust.city | lowercase}}
</li>
</ul>
</div>
<script src="angular.js"></script>
<script>
function SimpleController($scope)
{
$scope.customers = [
{name: 'John Smith', city: 'Phoenix'},
{name: 'Jane Smith', city: 'Pittsburgh'},
{name: 'John Doe', city: 'New York'},
{name: 'Jane Doe', city: 'Los Angeles'}
];
}
</script>
</body>
</html>
【问题讨论】:
标签: javascript angularjs