Skip to content

DI annotation fails on controllerProvider #556

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

Closed
jasonkuhrt opened this issue Nov 4, 2013 · 5 comments
Closed

DI annotation fails on controllerProvider #556

jasonkuhrt opened this issue Nov 4, 2013 · 5 comments

Comments

@jasonkuhrt
Copy link
Contributor

No time to look closely at the "why" but I'm pretty sure this is not working (but should be):

.state({
    ...
    controllerProvider: ['$stateParams', function($stateParams){
      return 'SetupStep' + $stateParams.step + 'Controller';
}]
@nateabele
Copy link
Contributor

The relevant code is here: https://github.com/angular-ui/ui-router/blob/master/src/state.js#L528-L530

It works fine the non-annotated way (i.e. function def only), so I have no idea why it wouldn't work the annotated way as well. I'll dig into it when I can, but it might not be for a while. :-/

@jasonkuhrt
Copy link
Contributor Author

@nateabele Confirmed it works fine the non-annotated way. I'd be curious if someone can confirm my issue.

@jasonkuhrt
Copy link
Contributor Author

A current solution is to use the func.$inject style http://docs.angularjs.org/guide/di.

@nateabele
Copy link
Contributor

Weird, $injector is supposed to treat all 3 styles simultaneously.

@nateabele
Copy link
Contributor

@jasonkuhrt And to be clear, yes, I changed the relevant unit test to use the array-annotated style and it failed, so the issue is definitely confirmed.

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

2 participants