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

Can't use link-to helper inside a child view #4815

Closed
bsclifton opened this issue May 5, 2014 · 3 comments
Closed

Can't use link-to helper inside a child view #4815

bsclifton opened this issue May 5, 2014 · 3 comments

Comments

@bsclifton
Copy link

I've found two possibly related issues with Ember regarding routes:

  1. If you try to use a link-to helper inside a child view (not associated with a route) which has a controller bound, you'll get a JavaScript error and the ember-application doesn't get generated in the DOM.
    Error: TypeError: get(...).container is null
    Example: http://jsbin.com/yised/2/edit?html,js,console,output

  2. As a workaround for the first issue above, I tried (inside that child view) binding an action that does a this.transitionToRoute(). This doesn't break rendering, but when clicked the action will throw the following JavaScript error.
    Error: TypeError: target is null
    Example: http://jsbin.com/kiwap/1/edit?html,js,console,output

@alexspeller
Copy link
Contributor

Manually creating controllers and assigning them to views will not work. You must let ember instantiate controllers for you.

@bsclifton
Copy link
Author

Thanks for helping me find the correct way to do this (using the render helper):
http://jsbin.com/yised/4/edit?html,js,output

In my case, in my real code, I have the template files broken out and I'm not using a precompiler (we're using RequireJS). Until we move to a precompiler, we can do something like:
Ember.TEMPLATES['user'] = "templateTextGoesHere"

Since the original functionality I asked about isn't supported... could this issue be converted to logging a more meaningful error message (at least in the debug build?)

@bsclifton
Copy link
Author

Going to mark as closed. Hoping that I'll have some time soon, then I can fork and try to create a PR either for the documentation or the console logs

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