我宣佈這個模塊:爲什麼我在JSFiddle中找不到錯誤模塊?
angular.module('dashboard', [])
.controller('dashboardController', ['$scope',
function ($scope) {
$scope.data = "555";
}]);
這裏是視圖:
<div ng-app="dashboard" data-role="page" id="layersProperty" data-add-back-btn="true" >
<div ng-controller="dashboardController">
{{data}}
</div>
</div>
這裏是FIDDLE。
在控制檯中我得到這個錯誤:
Error: [$injector:nomod] Module 'dashboard' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
任何想法,爲什麼我得到上述錯誤?
http://jsbin.com/qekezayipa/edit?html,js,output – Shyju
確實很奇怪。您完全相同的代碼,從相同的位置加載angular.js,在plnkr正常工作:http://plnkr.co/edit/NHqBPkItZiNsqhJ8beG7?p=preview –
在的jsfiddle,改變的JavaScript的負載類型是'不包 - 在
'或者'不循環 - 在'而不是onLoad'的'。這是一個JSFiddle的事情,以及它如何與Angular協同工作。 – Lex