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

Dom event functions go to wrong ractive instance when using a content directive. #1661

Closed
justspamjustin opened this issue Jan 27, 2015 · 2 comments

Comments

@justspamjustin
Copy link

I'm trying to use the content directive in a component, the same way I would use transclusion in angularjs. However, the issue I'm running into is that when I put a dom event on an element that is in the content directive, it tries to call the method on the incorrect ractive instance (the one that has the {{>content}} in its template). Instead it should call the method on the ractive instance that is providing the content to the generic class.

To reproduce this issue:

  1. Go to jsbin: http://jsbin.com/muqodoxoqi/1/edit?html,js,output
  2. Open your console
  3. Click on the first alert button (notice it works, because the button is outside of the content directive)
  4. Click on the second alert button, it doesn't work and you get the following error: Uncaught Error: Attempted to call a non-existent method

Expected Behavior:
It should call the method on the ractive instance that is providing the content to the content directive. It should not call the method on the generic instance that has the content directive.

@martypdx
Copy link
Contributor

Use {{yield}} instead of {{>content}}.

@justspamjustin
Copy link
Author

Of course! Thanks. I apologize for the noob question. :)

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