mamal
mamal

Reputation: 25

updating model from another controller doesn't update ui

i have 1 model and two controllers

App.Measure= DS.Model.extend({
name:DS.attr('string')
});

and two controller:

App.ModelController = Ember.ArrayController.extend({});

and

 App.MeasuresController = Ember.ArrayController.extend({
  needs:['Application','Measure'],
  setMeasure:function(name){
    this.get('controllers.Measure').set('model',App.Measures.find(name));
}
 });

App.Measures is a ember object that have ajax request and update model of measure.but when i can see ajax request is successful in chrome developer tools but the ui doesn't update. ui is a component that set to model

{{tree node=model}}

Upvotes: 0

Views: 678

Answers (1)

intuitivepixel
intuitivepixel

Reputation: 23322

The correct syntax is to use lower cased names for the controllers you need:

App.MeasuresController = Ember.ArrayController.extend({
  needs:['application','measure'],
  setMeasure:function(name){
    this.get('controllers.measure').set('model',App.Measures.find(name));
  }
});

And depending on the version of ember-data you use, e.g. in version 1.0.0 this line should read:

this.get('controllers.measure').set('model', this.store('measures').find(name));

Hope it helps.

Upvotes: 1

Related Questions