Hi I'm a little confused how ember works, I've got a app I'm creating which is to list tasks for a particular user. Here is my model:
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
location: DS.attr('string'),
date: DS.attr('date'),
archive: DS.attr('boolean'),
user: DS.attr('string'),
});
That is for when i add a task to the task list. However for when I get all the tasks in my tasklist i use this in my route:
model: function () {
return this.store.findAll('task');
}
For my filtering of all the users for the tasks I've add this to my controller:
filteredModel: Ember.computed('model', function(){
let model = this.get('model');
return model.filter(function(item){
return item.data.user == this.get('session.user.email');
});
}),
All of this works fine. However when I add a new task to the task list, it doesnt update my tasks list, so I have to reload my page. Can this be done automatically, without refreshing my page?
Aucun commentaire:
Enregistrer un commentaire