vendredi 4 août 2017

Ember template not updating when array in model is modified

I have a simple array of ints that I'm displaying on a page.

This is my model:

var Favorite = Ember.Object.extend({ stuff: Ember.A([1,2,3,4]) });

This is my template:

<li></li>

In my controller, modifications to this array generally display on the page (such as pushObject()), but modifying elements directly does not cause the page to update. I have a button on my page linked to this controller action:

actions: { arrayAdd() { this.get('model').stuff[0] = 100; } }

Clicking the button modifies the underlying array, but doesn't update the page. Is there a way to have ember automatically pick up on that change?

I'm doing this in Ember 1.13




Aucun commentaire:

Enregistrer un commentaire