jeudi 26 mars 2015

How is it possible to call a different controller's method in ember.js?

Inside another controller I get the application controller as following (as it is defined via needs):



appCtrl = this.get('controllers.application');


Accessing or setting properties works fine, e.g.



appCtrl.set("property", true);


will trigger registered listeners.


But I am not able to call a method of the application controller, e.g. assume there exists function x in the application controller. Then the following call fails as appCtrl contains no function x:



appCtrl.x();


I also tried defining x as an action in the application controller and triggering from outside as following:



appCtrl.send("x");


This also did not work.


How am I supposed to call a function of the application controller from another controller?





Aucun commentaire:

Enregistrer un commentaire