Skip to content
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

angular.extend() support #242

Closed
aramk opened this issue May 9, 2016 · 2 comments
Closed

angular.extend() support #242

aramk opened this issue May 9, 2016 · 2 comments

Comments

@aramk
Copy link

aramk commented May 9, 2016

angular.extend() usage doesn't seem to be supported by ng-annotate:

export default ngModule => {
  ngModule.directive('fooBar', (fooBar) => {
    return angular.extend({}, fooBar[0], {
      restrict: 'A',
      template: require('./template.html'),
      controllerAs: 'vm',
      controller: function($state, $window) {
        // ...
      }
    });
  })
}

Adding /*@ngInject*/ did it for me:

export default ngModule => {
  ngModule.directive('fooBar', (fooBar) => {
    return angular.extend({}, fooBar[0], {
      restrict: 'A',
      template: require('./template.html'),
      controllerAs: 'vm',
      controller: /*@ngInject*/ function($state, $window) {
        // ...
      }
    });
  })
}
@olov
Copy link
Owner

olov commented Jun 8, 2016

#245

@schmod
Copy link

schmod commented Aug 1, 2016

Is angular.extend() your problem, or is it the fact that you're doing this in an ES6 export statement?

Either way, I don't think that there's a good path for implicitly detecting annotatable functions inside of something like angular.extend(), _.extend(), or Object.assign() without hard-coding lots of special cases, or potentially picking up tons of false-positives.

Adding /*@ngInject*/ is definitely the way to go here.

@olov olov closed this as completed Oct 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants