In my Ember app, I have a common mixin/code which has a transition call
myCommonFn: function() {
//this.transition('someRoute') // Works if context is route
//this.transitionTo('someRoute') // Works if context is controller
}
Now because this function is common across multiple routes, it can either be triggered from a controller or route
My question is how do I ensure this works in both the cases? Meaning should I add a check using
this.constuctor() //Check if it is controller or route
OR should I do a null/undefined check for
this.transition() OR this.transitionToRoute()
What is the best way to make it work in all cases ?
Aucun commentaire:
Enregistrer un commentaire