我正在玩 AngularJS,但我收到一条错误消息:Argument 'Controller' is not a function, got undefined
这是 JSFiddle和 HTML 代码:
<h2>Hata's Tree-Like Set</h2>
<div ng-app ng-init="N=3;" ng-controller="Controller">
<input type="range" min="1" max="10" step="1" ng-model="N">
<div class="tree"></div>
</div
然后我在 JavaScript 中定义了 Controller
函数,由于某种原因它没有注册。
function Controller($scope){
$scope.$watch("N", function(){ ... });}
最佳答案
我遇到了完全相同的错误:argument 'HelloCtrl' is not a function
,未定义。
原来我的 hello.js
文件中有一个语法错误...HelloCtrl()
中的数组定义中缺少逗号。
我添加了逗号,然后一切都开始工作了!
希望这对您有所帮助。
关于javascript - 参数 ... 不是函数,未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15734757/