jeudi 4 juillet 2019

Use constant for Ember computed property dependent key

For an Ember app, is it possible to use a constant as part of a computed property key ?

So, essentially, I have a constant as below;

MY_SECTION {
MY_FIELD: "my-field-id"
}

What I want is a computed property on "my-field-id" i.e.

myCP: function() {
console.log('Inside CP...');
}.property('section.field.my-field-id.value')

However, I want to be able to use constant for my-field-id instead of using it directly. Is that possible ?




Aucun commentaire:

Enregistrer un commentaire