I have the following controller :
export default Controller.extend({
/* model is an array of Posts */
didDeletePost(post) {
/* PROBLEM HERE : post is an InternalModel */
this.get('model').removeObject(post);
},
actions: {
markPostForDelete(post) {
post.markForDelete(); /* starts a timer */
post.one('didDelete', this, this.didDeletePost);
},
clearMarkPostForDelete(post) {
post.clearMarkForDelete(); /* cancel a timer */
post.off('didDelete', this, this.didDeletePost);
}
}
});
But remove the post
in didDeletePost
does not work because the post
argument is the InternalModel
, not the DS.Model
.
How can I achieve this ?
As it does not seem to be easy to do it like this, I guess there should be a better way to implement this kind of timer ?
Aucun commentaire:
Enregistrer un commentaire