lundi 11 mars 2019

Ember 3 Computed Properties

I'm trying to migrate from ember 2 to ember 3, and i have problems with computed properties.

Before, i had this kind of computed properties in a component :

import Ember from 'ember';

totalPrice: Ember.computed('attr1', 'attr2', () => {
    return this.attr1 + this.attr2;
})

and i could do in the hbs template something like :

Total : 

In the new version of ember, i have this :

import { computed, set } from '@ember/object';

totalPrice: computed('attr1', 'attr2', () => {
   return this.attr1 + this.attr2;
})

But in the template, the displayButton property is display as [object] and not with the value. Am i missing something ?




Aucun commentaire:

Enregistrer un commentaire