Skip to content

Instantly share code, notes, and snippets.

@sipple
Last active December 25, 2015 14:38
Show Gist options
  • Select an option

  • Save sipple/6992056 to your computer and use it in GitHub Desktop.

Select an option

Save sipple/6992056 to your computer and use it in GitHub Desktop.
When I save the model for this controller, I'm trying to use the promise's resolution to transition back from the editUser route to the User route. All of the examples have some version of this.transitionTo (if the action is in the route) or this.transitionToRoute (if in the controller), but no matter where I place the action, the scope of "this…
Seanchai.EditUserController = Ember.ObjectController.extend({
actions: {
cancel: function() {
log.info("cancelling user edit");
this.transitionToRoute('user', this);
},
save: function() {
log.info("submitting user update...");
this.get("model").save().then(function(answer) {
return this.transitionToRoute('user', answer);
});
}
}
});
@sipple
Copy link
Copy Markdown
Author

sipple commented Oct 15, 2013

Per Yehuda Katz (and thank you for the help, Yehuda!):

You need to save of this (var route = this) and then use the saved off name inside

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment