In Ember you can call an action in your current context as you would a normal function, using this.actions.actionName()
. This means the action can return a value.
In my login route, I am trying to call an action from the application route in this way. However this.actions
only contains the actions in my login route.
Login Route
actions: {
test: function() {
console.log(this.actions.sameRouteAction()); //5
console.log(this.actions.applicationRouteAction()); // this.actions.applicationRouteAction() is not a function.
},
sameRouteAction: function() {
return 5;
}
}
Application Route
actions: {
applicationRouteAction: function() {
return 7;
}
}
What would this.actions.applicationRouteAction()
have to become in order for this to work?
Aucun commentaire:
Enregistrer un commentaire