olov / ng-annotate

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

ng annotate fails when using a variable for factory name #230

Closed scamden closed 8 years ago

scamden commented 8 years ago
var moduleName = 'nameeee'
angular.module(moduleName, [
  'aDep'
])

.factory(moduleName, function($q, ResourceSrvc) {

fails to annotate

scamden commented 8 years ago

@olov we use this almost everywhere any quick workarounds?

olov commented 8 years ago

just use "ngInject", like so: ... .factory(moduleName, function($q, ResourceSrvc) { "ngInject"; ...

scamden commented 8 years ago

@olov i said a quick workaround... i have literally hundreds of this case that i have to go add ngInject to...

this shouldn't be too hard a case to detect should it?

olov commented 8 years ago

We don't support matching these forms for a reason and if you're curious to learn more then check out the old issues (start with #20 and #22). My best advice to you is to use "ngInject".

scamden commented 8 years ago

ah false positives got it, ok well no worries i did a world wide find and replace and we're looking pretty good. thanks for making a rad tool!

olov commented 8 years ago

np!