-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
needs naming is incosistent with container lookup #2025
Comments
I just created an issue that is very similar. My problem is that there aren't any diagnostics on this; the binding just fails and nothing tells you why. Thanks for posting this |
Thanks, I can confirm this is an issue for me as well. |
I've been bitten by this one too. |
Bitten. Halp. |
This should be an easy one to fix. But the question is how we should be normalizing it. |
I think that whatever we do here, we can probably avoid breaking existing behavior so, while we need to fix this, we can probably wait until after RC. |
Since the only actual problem is that you can't use route name for the lookup, we could easily resolve this by supporting it. As you pointed out in #2000 it is not a bug that The only problem I see here is that if we have We could say that in this case you can't simply have a |
How about converting "posts.index" to "posts_index" and otherwise having it behave identically. I would--naively--expect that if needs: ["postsIndex"] results in a PostsIndexController instance as a property of |
That would solve the issue, but then it's not consistent with how the container works, unless we change that as well. |
This seems to be a big problem - there is no way to use needs to access a controller that is not single-syllably named atm? Does anyone have a workaround for using |
@alexspeller afaik the only workaround is to use the deprecated |
Great, thanks! |
The solution is to have a |
Normalize controller lookup, fix #2025
Was bitten by the bug causing this but pulled and built b22afef and can now make progress. One thing, for a controller like BarIndexController as in: ... is there a reason: this.get('controllers.bar.new') ...should be undefined? I would expect 'bar.new' to resolve to the controller defined for the route. |
I'm running into the same issue as @inkredabull. For example, I'm not sure where to tell the container to register |
As it was pointed out in #2000, when specifying a controller name for the container lookup one should use
posts.index
if it is the controller which belongs to aposts.index
route. This works out great when usingApp.__container__.lookup("controllers:posts.index")
, but when specifyingneeds
Here's a JSBin illustrating the issue
results in
controllers.posts.index
being undefined, whilepostsIndex
returns a new instance of theApp.PostsIndexController
which isn't the one associated with theposts.index
route.This means that the
App.FooController
doesn't isn't able to reach into the content ofposts.index
controller.The text was updated successfully, but these errors were encountered: