samedi 23 décembre 2017

ember component increment/decrement value

I am stuck with increment and decrement a value in a component js. I got this in my template:

<div class="circleBase" > <p>   C </p> </div>

For now I just want to increment the heat value when I am clicking on the div. My component looks like this:

    init() {
        console.log('init');
        this._super(...arguments);
        this.errors = [];
      },
      didRender() {
        this.setProperties({
          heat: 0
        });
      },
    actions: {
        upHeat: function(a){
            this.set('heat', this.heat +1)
            //or
            this.setProperties({
                heat: this.heat +1
              });
           console.log(heat);
        }
      }

This is not working. Each time I click on my div the heat-value is incremented but not saved. My template still shows 0 as value.




Aucun commentaire:

Enregistrer un commentaire