I am attempting to use an existing controller that I have working for viewing a user for creating a new user.
I have my newuser.js route defined as follows:
export default Ember.Route.extend({
setupController: function(controller, model) {
model = this.store.createRecord('user');
this.controllerFor('settings.users.user').setProperties({isNew:true, model: model});
},
resetController: function(controller) {
var user = controller.get('model'); // this always returns null
if (user.get('isDirty')) {
user.rollback();
}
},
renderTemplate: function() {
this.render('settings/users/user');
}
});
Everything works as it should to display, however when resetController is called - at the point I want to remove the item from the store if it is dirty, the model is always returned as null.
Aucun commentaire:
Enregistrer un commentaire