olov / ng-annotate

Add, remove and rebuild AngularJS dependency injection annotations
MIT License
2.03k stars 150 forks source link

Not annotate when using constant #198

Closed ghahramani closed 9 years ago

ghahramani commented 9 years ago

Hi, I faced to a problem when I use constants

Not Annotated
angular.module(constants.module).controller(constants.controllers.error, function ($scope) {

});
Annotated:
angular.module(constants.module).controller(constants.controller, /** @ngInject */function ($scope) {

});
Annotated:
angular.module(constants.module).controller("Error", function ($scope) {

});

Is there anyway to avoid add /* @ngInject / when you are using constants?

olov commented 9 years ago

Unfortunately no, see https://github.com/olov/ng-annotate/issues/20 for history. PS I recommend this syntax:

angular.module(constants.module).controller(constants.controller, function ($scope) {
    "ngInject";
    ...
});