문제

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?

If I add the following line it works, but I would like to take advantage of ngInect.

Config['$inject'] = ['$routeProvider'];

Thanks

도움이 되었습니까?

해결책

The closure compiler needs to run with the "--angular_pass" flag.

다른 팁

I solved this way :

var app = angular.module("myApp", ['ngRoute']);
app.config(['$routeProvider', Config]);

I am using typescript...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top