swimlane / angular1-systemjs-seed

AngularJS 1.x + SystemJS Seed
MIT License
210 stars 40 forks source link

fix ngAnnotate use #23

Closed darcnite3000 closed 9 years ago

darcnite3000 commented 9 years ago

https://github.com/olov/ng-annotate#explicit-annotations-with-nginject

$futureStateProvider.stateFactory('load',($q, $ocLazyLoad, futureState)=>{
  'ngInject';

  return $q((resolve,reject)=>{
    //code here
  });
});
amcdnl commented 9 years ago

Interesting, did not know that.

amcdnl commented 9 years ago

this shouldn't be an issue on latest though. Since we manually annotated the items.

lookfirst commented 9 years ago

I tried all sorts of variations of that and couldn't get it to work right. =( The one I didn't try was putting the 'ngInject' inside of the method like @darcnite3000 has done, I thought it had to occur above it based on the docs. =(

lookfirst commented 9 years ago

I just tested it and his fix works, but honestly, I don't see it as that much of a stylistic benefit. =( It is far more clear to just write out the injection.

amcdnl commented 9 years ago

I agree, don't love the special syntax

darcnite3000 commented 9 years ago

I was mainly showing how it could work without manually annotating. In the end it comes down to preference.

amcdnl commented 9 years ago

@darcnite3000 - absolutely and thanks for the share.