This seems to be very simple problem but I can't find any solution for this. I want to refresh the data for unprocessedDailyDataFile
from action. I can get the model by modelFor()
method. But when I try to use get()
and set()
method with the model they fails as undefined.
App.AdminRoute = Ember.Route.extend({
model: function(){
return {
companies: this.store.find('company'),
unprocessedDailyDataFiles: this.store.find('unprocessedDailyDataFile')
};
},
actions: {
reloadUnprocessedDailyDataFile: function(){
var model = this.modelFor('admin');
// both properties from the model is accessible here
// model.get() fails
// model.set() fails
}
}
});
For the model to reload, you can use
actions: {
reloadUnprocessedDailyDataFile: function(){
let model = this.get('controller.model'); // for Get and Set
model.get('name');
model.set({ name: 'john'});
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With