vendredi 25 septembre 2015

Calling controller method from controller action in Ember 2.0

Ember 2.0 is really giving me a hard time to understand the new functionality. I want to call a method in the controller from the action function, but dont seem to find a way how. Wasted some time on this already

I have read this: calling method from action of controller in emberjs but it is only working for Ember 1.x as in Ember 2.0 there is no ArrayController anymore and I cannot use this.send().

Basically what I would need is:

App.SomeController = Ember.Controller.extend({
   methodFunction: function(data) {
      console.log("YEY", data);
   }
   actions: {
      sessionAction: function(data) {
          this.methodFunction(data);
      }
   }
});

Problem is that this.methodFunction is not available




Aucun commentaire:

Enregistrer un commentaire