I have a project in Grails 2.4.4 in which I also use AngularJS.
I've decided to use the Asset Pipeline Plugin along with AngularJs Annotate Asset-Pipeline. The first one for processing, minifying, etc the static assets(js,css, etc) and the second one for getting the myFunc.$inject = [...]
"injection" in every function that requires it due to the injection dependency in which AngularJS relies on.
According to the doc of AngularJs Annotate Asset-Pipeline it should put the myFunc.$inject=[]
when the war is going to be generated on my js files when required, but the true is different: it is not working at all (I do not see any $inject
in the minified file and the app breaks due to the dependency injection widely discussed on SO (examples: Angularjs error Unknown provider and AngularJS Error: $injector:unpr Unknown Provider)
Below is the relevant code (if any other is required, please, let me know)
BuildConfig.groovy
compile "org.grails.plugins:asset-pipeline:1.9.9"
compile "org.grails.plugins:angular-annotate-asset-pipeline:2.4.1"
AngularJS controller (this is just an example)
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";
}