Nicolas Nicolas - 1 year ago 137
AngularJS Question

ngInject and closure compiler

I try to compile the following code in ADVANCED mode unsuccessfully:

* @description App configuration
* @param {!angular.$routeProvider} $routeProvider
* @constructor
* @ngInject
function Config ($routeProvider) {
.when('/', {
templateUrl: 'mainpage/mainpage.html',
controller: 'MainpageCtrl'
.when('/viewer', {
templateUrl: 'viewer/viewer.html',
controller: 'ViewerCtrl'
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'];


Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download