-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding @ngInject where ng-annotate already matches should not create duplicate injection arrays #28
Comments
There are two things going on here:
Thanks for filing, I'll release 0.9.4 once I have it fixed. |
Good job with the write-up and issue title, I know I struggled 😃 |
Update on point 2 in my previous comment: 0.9.4 is going out tomorrow unless something unexpected happens. |
Excellent! Thanks for the great work. One more question: how does grunt-ng-annotate update itself in relation to |
Let me answer that: grunt-ng-annotate depends on any ng-annotate 0.9.x version ("^0.9.0") so there'll be no delay for releases before 1.0. Other ng-annotate integrations works the same generally. Once 1.0 is out we'll discuss and document what constitutes an ng-annotate major, minor and patch release in semver terms. |
Yup, what @olov said. Note that if you add grunt-ng-annotate to dependencies and do 'npm install' and when after that a new 0.9.x ng-annotate version is released, invoking 'npm install' once again won't update ng-annotate, that's how npm works. If you need the new version, you have these options:
|
Thanks guys! |
0.9.4 is now relased |
Just tested this, working great, thanks! |
Consider the following (which is real world production code):
As you can see, only the first
controller: function ()
gets annotated. The other one doesn't because I'm using a variable instead of directly using$stateProvider
(this is fine, I don't thinkng-annotate
should deal with variables).However, this poses a problem because I need to
/*@ngInject */
only the secondcontroller: function ()
; if I also/*@ngInject */
the first one, it gets annotated twice. I don't want developers to be thinking whether they should include/*@ngInject */
in their code, so I rungrunt-text-replace
beforegrunt-ng-annotate
to pre-process some files. With this particular example I have to distinguish between both kind ofcontroller: function ()
uses to only/*@ngInject */
the second one.Looking at ng-annotate-main.js I found this:
If that check were made, the first
controller: function ()
wouldn't be annotated and I could just/*@ngInject */
every use of it in the file.Or maybe
/*@ngInject */
should only work on pieces of code which haven't already been annotated (which would also allow me to/*@ngInject */
everycontroller: function ()
).Thanks!
The text was updated successfully, but these errors were encountered: