執行程式碼的時候,google developer tool封包The controller with the name 'my-injectorCtrl' is not registered的錯誤,如果我想使用推斷式註入,這樣寫哪裡錯了。本人菜鳥,實在想不出哪裡錯了,望各位大神指點,感激不盡!
<p ng-app>
<p ng-controller="my-injectorCtrl">
<span>{{TestInjector1}}</span>
</p>
</p>
var myInjectorModule = angular.module("MyInjectorModule",[]);
var myInjectorCtrl = function($scope){
$scope.TestInjector1 = "Hello Injector";
}
myInjectorModule.controller("myInjectorCtrl",myInjectorCtrl);
雷雷
改成下面這樣就可以了
HTML檔案內容:
JS文件內容: