0
エラー:$ controller:ctrlregこの名前のコントローラは登録されていません。私のスクリプトはすべて読み込まれ、すべてをindex.htmlに追加しました。角度コントローラがXAMPP Webサービスに登録されていません
マイコントローラ:
(function() {
angular.module("nsoftModule").controller("nsoftController", ["nsoftService", function(nsoftService) {
var self = this;
self.service = nsoftService;
}])
})();
マイディレクティブ:
(function() {
var weatherMod = angular.module("nsoftModule", []);
weatherMod.directive("nsoftDirective", function() {
return {
templateUrl: "Template/weatherTemplate.html",
controller: "nsoftController as nsoftCtrl"
}
});
})();
マイサービス:
(function() {
var weatherMod = angular.module("nsoftModule", []);
weatherMod.service("nsoftService", ["http", function(http) {
var service = this;
}]);
})();
マイモジュール:
(function() {
var weatherMod = angular.module("nsoftModule", []);
})();
マイテンプレート:
<div class="container">
<div ng-controller="nsoftController">
<p>Name : <input type="text" ng-model="name"></p>
<h1>Hello {{name}}</h1>
</div>
</div>
マイapp.js:
(function() {
angular.module("nsoftApp", ["nsoftModule"]);
})();
そして、私のindex.html:
ディレクティブからHTMLでそれを宣言する必要を割り当てていないので、彼の
のように使用し、あなたの答えSachilaのためにありがとうございましたが、私はまだもあなたと同じエラーを取得します改善... –
これをチェックしてください。私は答えを更新しますhttps://plnkr.co/edit/9d64fOb9QhNgCeKl90VY?p=preview –
あなたよりも、それは素晴らしい、動作します! –