【发布时间】:2017-10-24 00:17:04
【问题描述】:
我在 Grails 2.4.4 中有一个项目,其中我也使用 AngularJS。
我决定将Asset Pipeline Plugin 与AngularJs Annotate Asset-Pipeline 一起使用。第一个用于处理、缩小等静态资产(js、css 等),第二个用于在每个需要它的函数中获取 myFunc.$inject = [...]“注入”,因为 AngularJS 依赖注入依赖。
根据AngularJs Annotate Asset-Pipeline 的文档,它应该在需要时将myFunc.$inject=[] 放在我的js 文件上生成战争时,但事实不同:它根本不起作用(我没有看到缩小文件中的任何$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";
}
【问题讨论】:
标签: javascript angularjs grails asset-pipeline annotate-asset-pipeline