チェックポイント
①スペルミス
②ng-controller=”[空]”
③ng-controller=”[存在しない定義]”
例)
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
<html ng-app>
<script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js”></script>
<script>
var loopCtrl = function($scope) {
$scope.week = [
{“jp”:”月”,”en”:”Monday”},
{“jp”:”火”,”en”:”Tuesday”},
{“jp”:”水”,”en”:”Wednesday”},
{“jp”:”木”,”en”:”Thursday”},
{“jp”:”金”,”en”:”Friday”},
{“jp”:”土”,”en”:”Saturday”},
{“jp”:”日”,”en”:”Sunday”}
];
}
</script><div ng-controller=”hoge”></div><div ng-controller=”loopCtrl”>
<p>{{week.length}} days</p>
<ul>
<li ng-repeat=”day in week”>{{day.jp}} {{day.en}}</li>
</ul>
</div>
</html>
<script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js”></script>
<script>
var loopCtrl = function($scope) {
$scope.week = [
{“jp”:”月”,”en”:”Monday”},
{“jp”:”火”,”en”:”Tuesday”},
{“jp”:”水”,”en”:”Wednesday”},
{“jp”:”木”,”en”:”Thursday”},
{“jp”:”金”,”en”:”Friday”},
{“jp”:”土”,”en”:”Saturday”},
{“jp”:”日”,”en”:”Sunday”}
];
}
</script><div ng-controller=”hoge”></div><div ng-controller=”loopCtrl”>
<p>{{week.length}} days</p>
<ul>
<li ng-repeat=”day in week”>{{day.jp}} {{day.en}}</li>
</ul>
</div>
</html>
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
[ng-controller=”hoge”]はJavaScriptで定義されていないため、AngularJS動作しません。
また、[ng-controller=””]の場合もAngularJS動作しませんので注意が必要です。