我一直在关注一个教程,教科书向我保证这是有效的,但它是轰炸
错误:[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>
Run Code Online (Sandbox Code Playgroud)