jeudi 5 novembre 2015

Ember, observer listening to an property in another controller

I have two controllers Tags and Reports. Tags Controller need's to observe data property on Reports. However the data property is async and updated after a call on the server. How do I get the property inside Reports?

I'm trying to do something like the following:

ReportsController({
  data: null,
  actions: {
    onAsyncCall: function(updatedData) {
      this.set('data', updatedData);
    }
  }
});

TagsController({
  reportsController: Ember.inject.controller('reports'),
  doSomethingDataUpdate: Ember.observer('reportsController.data', function() {
    this.set('tagProperties', this.get('reportsController.data'));
  }
});

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire