In my Ember application I have two routes, people and person.
When I transition into person the value of the current model is binded to a property in the application controller.
App.ApplicationController = Ember.Controller.extend({
needs: [ 'person' ],
currentPerson: Ember.computed('controllers.person.currentPerson', function () {
var person = this.get('controllers.person.currentPerson');
return person ? 'selected person #' + person.id : 'no one has been selected';
})
});
App.PersonController = Ember.Controller.extend({
currentPerson: Ember.computed.alias('model')
});
When I transition out of the person route I want to clear the value, ideally destroying the person model.
I've tried:
willTransition: function () {
this.get('model').destroy();
}
But this doesn't work. How do I properly delete the cached route model?
Example: http://ift.tt/1RoiPtV
Thanks!
Aucun commentaire:
Enregistrer un commentaire