Nested Components and Controllers with closure action


#1

Hi!

I have an Ember App where I’m trying to use closure actions, Our setup is the following

The action I need is in application.js called invalidateSession.

Now our routes are nested:

We have download routes that is nested in welcome route that is nested in application route.

Also I have a component within the download template that also renders another component. The components are:

  1. download-generic
  2. steps-action (this is rendered inside the download-generic component and is the one that needs to call invalidateSession action that resides in the application route

I tried passing the a closure action to steps-action: (using emblemjs)

= steps-action click=(action “invalidateSession”)

What happens is Ember is looking for the action within the parent component (download-generic). I also tried passin the closure action to the download-generic

= download-generic invalidateSession=(action “invalidateSession”)

What happens is Ember is looking for the action in the download route instead of “bubbling”/looking for the action in the application route.

Now, how do I invoke an action from the application route in a very nested component? how do I make sure that the closure action in the nested component point towards the actions hash of the application route.

Thanks in advance for your help!


#2

I know this is old. But you can’t use route actions in closure actions (http://stackoverflow.com/questions/31101296/how-to-call-an-action-on-a-route-using-closure-actions)

For now, you can use the ember-route-action-helper addon