내가 AngularJS와의 초보자각 서비스 주입
내가
angular.module('TestModule', []).service('testservice', ['$timeout', testservice]);
function testservice($timeout) {
/* my function */
}
내가 app.js
아래로 내 주요 모듈이 모듈을 주입하고 다음과 같이 각도 서비스를 오전 일치하지 않습니다angular.module("MainModule", ['TestModule']);
아래로 내 컨트롤러에 testservice을 주입하려고
(function() {
'use strict';
angular
.module('MainModule')
.controller('testController', ['$scope', '$state', 'testservice', testController]);
function testController($scope, $state, testservice) {
/*I have my functions here */
}
})();
,
때때로, 그것은 성공적으로 주입됩니다 때로는 년에는
알 수없는 공급자 다음과 같이 오류가 발생합니다 : testserviceProvider < - testservice을 < - testController
나는 문제에서 추측 할 수없는 내가 완전히 붙어 그것. 내가 뭘 잘못하고 있니?
내가 게시 한 코드에서 이것이 가능하지 않은 것으로 나타났습니다. 이 오류를 재현 할 수있는 큰 소리 또는 피들을 제공하십시오. – estus
실제로이 간단한 것은 예상대로 작동하지만 큰 응용 프로그램에서 같은 종류의 것을 병합하면 일관성이 없습니다 –
$ timeout의 일부 약속과 관련이있을 수 있습니다. – neptune