2

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 providerAngularJS 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"; 
} 

답변

1

단답형 :

변경 의존성 버전

양식이 :

나는의 저자가 결론에 도달

compile "org.grails.plugins:angular-annotate-asset-pipeline:1.1.3"

긴 이야기

AngularJs Annotate Asset-Pipeline 파고 후, 그리고 친구가 제공하는 도움이-

compile "org.grails.plugins:angular-annotate-asset-pipeline:2.4.1" 

이 플러그인은 내부의 로직을 삭제했습니다.

즉, 현재 플러그인 (2.4.1)의 현재 버전 (2001 년 5 월 25 일)은 누구도 사용하려고했던대로 사용할 수 없음을 의미합니다.

누군가가이 문제를 겪고 있다면, 성공적으로 사용할 수 있었던 최신 버전 인 1.1.3을 사용해야합니다.

관련 문제