ngInject和关闭编译ngInject

由网友(时间生个野种叫回忆)分享简介:我尝试编译在高级模式不成功以下code:I try to compile the following code in ADVANCED mode unsuccessfully:/*** @description App configuration* @param {!angular.$routeProvider}...

我尝试编译在高级模式不成功以下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.

阅读全文

相关推荐

最新文章