mercredi 21 septembre 2016

Ember unable to observe controller property

In my Ember app, I want to observe a controller property change.

Below is my code to set the mode;

var togglerModel = this.controllerFor(this.routeName).Vmtoggler[0];
this.controllerFor(this.routeName).set('togglerModel', togglerModel);

modelChanged: function() {  
            debugger;
    }.observes('togglerModel.model'),

My togglerModel is an object that looks like

{
label: 'XYZ',
model: [{
id: '123',
selectedValue: 'abc'
},{
id: '456',
selectedValue: 'def'
}]
}

The individual model array elements actually correspond to some form elements (text box, dropdown, etc) and the model.selectedValue does get updated on change

But my question is my "modelChanged" property does not get invoked as I change any of the form elements.

What am I doing wrong here?




Aucun commentaire:

Enregistrer un commentaire