Grails 2.4.4에서 AngularJS를 사용하는 프로젝트가 있습니다.Grails 2 프로젝트에서 angular-annotate-asset-pipeline이 전혀 작동하지 않습니다.
나는 AngularJs Annotate Asset-Pipeline과 함께 Asset Pipeline Plugin을 사용하기로 결정했습니다. 정적 애셋 (js, css 등)을 처리, 축소하는 등의 첫 번째 작업과 AngularJS가 의존하는 주입 의존성으로 인해 모든 기능에서 "주입"을 myFunc.$inject = [...]
에 "주입"하는 두 번째 방법입니다.
필요할 때 전쟁이 내 JS 파일에 생성 될 것입니다,하지만 사실은 다른 경우가 myFunc.$inject=[]
을 넣어해야 AngularJs Annotate Asset-Pipeline의 문서에 따르면이 전혀 작동하지 않습니다 (나는 어떤 $inject
에 표시되지 않습니다 축소 된 파일 널리 SO에 논의 된 dependency injection로 인해 응용 프로그램 나누기 (예 : Angularjs error Unknown provider 및 AngularJS Error: $injector:unpr Unknown Provider) 아래
는 (다른이 필요한 경우, 알려 주시기 바랍니다) 관련 코드
BuildConfig .groovy
,compile "org.grails.plugins:asset-pipeline:1.9.9"
compile "org.grails.plugins:angular-annotate-asset-pipeline:2.4.1"
AngularJS와 제어기 (이 예에 불과)
angular
.module('app', [])
.controller('myCtrl', myCtrl);
/*@ngInject*/ // << --- did not work!
function myCtrl ($scope){
//I also used the "ngIngect"; alternative here and it did not work either!
$scope.myVar = "sample text";
}