vendredi 6 mai 2016

Ember access controller attribute within common route/controller mxiin

I have a attribute defined in my controller as

myControllerAttr

Also there is a common mixin extended by both the route/controller (my-mixin.js)

Now in my-mixin.js, there are various methods which get called from both route/controller class

My question is within these mixin methods, how do I access the controller attribute myControllerAttr

since this.myControllerAttr may not work always

It would depend on whether the method was invoked from a route or controller class

Should I add an if condition OR what is the best way ?

So to summarize, my question is how do I check between

this.get('myControllerAttr') V/s
this.controllerFor(this.routeName).get('myControllerAttr')




Aucun commentaire:

Enregistrer un commentaire