Skip to content

Annotation doesn't work for a controller with name as a variable #19

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

Open
EladBezalel opened this issue Feb 8, 2017 · 1 comment
Open

Comments

@EladBezalel
Copy link

And probably with any other .module api

I use webpack and angular

import angular from 'angular';

const MY_CONTROLLER = 'myController';

angular.module('myApp').controller(MY_CONTROLLER, $scope => {});

export default MY_CONTROLLER;
@schmod
Copy link
Owner

schmod commented Jul 12, 2017

There's some history here about why this is difficult:
olov#22

In general, in this use-case (and all use-cases, really), I strongly recommend using the explicit 'ngInject'; prologue directives (and explicitOnly configuration option) to annotate your functions.

Also, in your specific example, I'd advise against using a lambda function for a controller declaration, as you'll have no way of accessing your controller's of this.

I'll leave this open, as it's something that we could hypothetically support some day. However, I want to lean on the side of caution when making any changes that could introduce false-positives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants