So I'm brand new to Ember (using ember-cli 3.0.4), and trying to understand how to do what to me are normal things. I've a form, inside a component, where the user updates information, and clicks Save. I've built an action that the component calls when the Save button is clicked, and that action calls save() on the model object. So far, so good.
My problem is that I want to redirect to a different page when the save() promise completes. I can't figure out how to do that. The emberjs guide for actions doesn't once mention redirecting, and only the Routing module seems to have any mention of redirecting.
Obviously, there's an "embery" way of doing things that I don't know yet, but so far I can't figure out what that is. How are simple redirects after save done best in Ember?
Component code:
export default Component.extend({
actions: {
saveCountry() {
var self = this;
if (this.country.get('hasDirtyAttributes')) {
this.country.save().then(
//???
);
}
}
}
The Route code:
export default Route.extend({
model(params) {
return this.get('store').findRecord('country', params.country_id);
}
});
Thank you!
Aucun commentaire:
Enregistrer un commentaire