0
我剛開始接觸AngulasJS,當我運行此代碼,我收到錯誤「參數‘teacherCtrl’是不是一個功能,得到了不確定的」,但它明確規定。請幫忙。角JS控制器不工作
<body>
<script>
function teacherCtrl($scope) {
$scope.teachers = [
{ name: 'Bill Melega', subject: 'History'},
{ name: 'Top Stanfa', subject: 'English'},
{ name: 'Mike Bremer', subject: 'English'}
];
}
</script>
Name: <input type="text" ng-model="search"> {{search}}
<table ng-controller="teacherCtrl">
<tr ng-repeat="teacher in teachers | filter:search">
<td ng-repeat="property in teacher">
{{ property }}
</td>
</tr>
</table>
</body>
能否請您告訴我們您的完整代碼?你的'ng-init'在哪裏? – gdoron 2014-12-06 22:39:26
http://stackoverflow.com/questions/25111831/controller-not-a-function-got-undefined-while-defining-controllers-globally/25111942#25111942的可能的複製? – PSL 2014-12-07 02:07:40