How to call an action defined in a route from a method of the same route?


#1

I’ve got index route that has openModal action. Is there a way to call this action from renderTemplate method in the same route? If I move openModal action up - i.e. to application route, I can call it from a method in index route by this.send('openModal');. Do I have to move it up or is there some way to call it from index route?


#2

what I’ve done was to create a method inside the Route - let’s say foo() - and in my action I just call this method with this.foo() as I would call it outside. see my jsbin which explains my solution :slight_smile:


#4

You can also use this.send('openModal') in Index route to send the action openModal to it. No need to move up action


#5

I think I tried that and it didn’t work - that’s why I moved it up to application. I’ll try it again though, maybe I messed something up.