[英]Error injector when register on module in angular
我有如下注冊模型:
var angularTest = angularTest || {};
angularTest.app = angular.module('angularTest', ['xPlat.service', 'xPlat.controller', 'xPlat.directives', 'xPlat.repository']).run(function (DB) {
DB.init();
});
angular.module('xPlat.config', []);
angular.module('xPlat.directives', []);
angular.module('xPlat.controller', []);
angular.module('xPlat.service', []);
我有一個正確使用的控制器(這不是錯誤),如下所示:
angularTest.app.controller('logInController', ['$scope', '$http', function ($scope, $http) {
$scope.login = function () {
var request = $http({
method: "post",
url: "http://localhost:4309/Account/Login",
data: ""
})
}
}]);
但是下面的這個控制器有錯誤:
(function () {
'use strict';
angular.module("xPlat.controller", ['xPlat.service'])
.controller('itemController', function ($scope, itemService) {
// todo something
});
})();
我想像上面的logInController一樣更改它。 我該如何更改?
將您的代碼放在單個JS文件中時,它對我有用。 我假設您不將包含xPlat.controller的文件包括在index.html頁面上的a中(或者如果您是微型的,則不包括它)。
如果您需要更多幫助,可以嘗試在jsfiddle中復制它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.