mardi 28 juin 2016

Call one controller from another without reloading it

I need to call one controller from another.

export default Ember.Controller.extend({
  needs   : ['another'],
  ....
  callAnother: function() {
    this.get('controllers.another').reloadIt();
  }
})

Another controller:

export default Ember.Controller.extend({
  init: function() {
     calling API
  }
  reloadIt: function() {
    calling API
  }
})

When I call this.get('controllers.another').reloadIt(). It calls init and reloadIt.

Is it possible to call it without init because it's already loaded.

Thanks.




Aucun commentaire:

Enregistrer un commentaire