ngInject和关闭编译 [英] ngInject and closure compiler
本文介绍了ngInject和关闭编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试编译在高级模式不成功以下code:
I try to compile the following code in ADVANCED mode unsuccessfully:
/**
* @description App configuration
* @param {!angular.$routeProvider} $routeProvider
* @constructor
* @ngInject
*/
function Config ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'mainpage/mainpage.html',
controller: 'MainpageCtrl'
})
.when('/viewer', {
templateUrl: 'viewer/viewer.html',
controller: 'ViewerCtrl'
})
.otherwise({
redirectTo: '/'
});
}
有没有开启任何特殊的标志?
Is there any special flag to be turned on?
如果我添加以下行它的工作原理,但我想借此ngInect的优势。
If I add the following line it works, but I would like to take advantage of ngInect.
Config['$inject'] = ['$routeProvider'];
感谢
推荐答案
封闭编译器需要用--angular_pass标志运行。
The closure compiler needs to run with the "--angular_pass" flag.
这篇关于ngInject和关闭编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文