Ex:
I have model/test.js
export default Model.extend({
name: attr('string'),
email: attr('string'),
address: attr('string'),
age: attr(),
phone: attr()
});
In component.js
list: computed('model.{}', function() { });
Fetching data in route and passing it to the template. In child component i am trying to access it. initially data passed will be like
{
'data': {
name: 'test'
}
}
later sending data as
{
'data': {
name: 'test',
email: '[email protected]',
address: 'XYZ',
age: 10,
phone: 423423
}
}
But in computed property it is not listening second updated data. I want to listen dynamically each property in model. It will work if i give like
list: computed('model.{name,email,address,age,phone}', function() { });
But i want some other solution for it. Dynamically need to listen each property in model object.
If you are dealing single object, then what you have is the right and only possible way to go.
list: computed('model.{name,email,address,age,phone}', function() { });
Suppose if your model is array of object then you can do the below things,
list: computed('model.@each.{name,email,address,age,phone}', function() { });