2014-09-23 3 views
0

각도 타이머를 설치하기 위해 모든 단계를 수행했지만 올바르게 개발 빌드에서 작동하지만 제작 빌드 (축소, concatinated)를 시도하면 an

Uncaught Error: [$injector:modulerr] 

의견이 있으십니까?

+0

어떻게 당신이 당신의 컨트롤러를 정의? –

+0

컨트롤러에 아무 것도 추가하지 않고 있습니다. {{days}} 일, {{hours}} 시간, {{minutes}} 분, {{seconds}} 초. 지시문 –

답변

0

컨트롤러를 "Minification을 위해 안전"으로 정의했는지 확인하십시오. $ inject 서비스를 사용하여 종속성을 정의하거나 컨트롤러 정의에서 종속 항목을 텍스트로 정의 할 수 있습니다.

나는 documentation 여기에 인용하고 있습니다 :

Since Angular infers the controller's dependencies from the names of arguments to the controller's constructor function, if you were to minify the JavaScript code for your controller, all of its function arguments would be minified as well, and the dependency injector would not be able to identify services correctly.

$의 분사를 사용 :

function myCtrl($scope, $http) {...} 
myCtrl.$inject = ['$scope', '$http']; 
app.controller('myCtrl', myCtrl); 

인라인 주석

function myCtrl($scope, $http) {...} 
app.controller('myCtrl', ['$scope', '$http', myCtrl]); 
+0

인라인 주석을 사용하고 있지만 컨트롤러가 비어있는 새 프로젝트를 만들었 는데도 오류가 발생합니다. 전에 말했듯이 여분의 j를 추가 할 필요가 없습니다. https://db.tt/2NLGt896 –

관련 문제