The problem is that i can't correctly display the changes i make to an ember property.
Here's the action:
toggle_favorites: function() {
var favorite = this.get('some_service').get("favorites");
this.set("favorite", favorite);
if (favorite.length > 0) {
this.set("hasFavorites", true);
}
// show some feedback, irrelevant
},
after that i just display everything as a list
...
The problem is that if i keep adding stuff to the list, the changes won't be reflected in the hbs file.
I tried using a computed property as follows
favs: Ember.computed("hasFavorites", "some_service.favorites", "favorite.length", function() {
return this.get("favorite");
}).property('@favorite.length'),
and display that, but with no avail. If i add something to the list, and then trigger my action it's successful, but every sequential addition won't be displayed.
I'm using Ember 2.6.
Aucun commentaire:
Enregistrer un commentaire