How to call function in other route then i am


#1

App.BbbRoute = Ember.Route.extend({ actions:{ doSomething: function() } })

App.AaaRoute = App.BbbRoute.extend({ //how can i call doSomething from here ??? })

when i try to call doSomething i get error message “Can’t trigger action 'doSomething ’ because your app hasn’t finished transitioning into its first route, you can call .send() on the Transition object passed to the model/beforeModel/afterModel hooks”

i didnt understand how to do that


#2

Whats your use case / structure?

You can send actions that will bubble up.

So an action will bubble up its parent routes until it hits the application route.

The error: “Can’t trigger action 'doSomething ’ because your app hasn’t finished transitioning into its first route, you can call .send() on the Transition object passed to the model/beforeModel/afterModel hooks” is usually called when you’re trying to call an action on a route you’re currently transitioning to or one that hasnt fully built (like if you deep linked to a url).

What you can do is call:

afterModel: function(model, transition) {
  transition.send('doSomething');
}