jeudi 12 octobre 2017

Listen for new added properties on a computed function

I have the following object:

{ 
types: ["Type A", "Type B", "Type C"],
colours: ["Red", "Blue", "Black"]
}  

which I send as parameter to a component

export default Ember.component.extend({
  tableContent: function(){
  const keys = Object.keys(this.get('config'));
  if (keys.length > 1){
    let array = [];
    keys.shift();
    keys.forEach((element) => {
     array.pushObject({name: element});
    });
    return array;
  }
}.property('config') 

I want to be able to listen for changes when creating a new addition. Ex:

{ 
types: ["Type A", "Type B", "Type C"],
colours: ["Red", "Blue", "Black", "Yellow"].
lang: ["en","fr","es"]
} 

I have tried using .property('config.@each') but it wont work.

Any ideas? Thanks.




Aucun commentaire:

Enregistrer un commentaire