vendredi 25 décembre 2020

Ember-Octane: Obj can't be observed in template while updated?

Most of you thought this is a weired question. Me too...

So, here is a controller file I'm having

application.js

export default class Application extends Controller.extend(someMixin)  {
   @tracked markedValues = {
      item1: {content: "This is item1", count: 1}
      item2: {content: "This is item2", count: 1}
   }

   @action updateCount(itemKey) {
       this.markedValues[itemKey].count = this.markedValues[itemKey].count + 1;
       this.markedValues = {...this.markedValues}
   }
}

application.hbs
  
        <div > and number is </div>
  

While I was updated the count it never reflects in the template. What mistake I did in this place?




Aucun commentaire:

Enregistrer un commentaire