I have a route for new-thing
and it's template is a form. When this form submits, I call a createThing
action in the route, passing in this
.
export default Ember.Route.extend({
model() {
return {};
},
actions: {
createThing(thing) {
let thingToSave = this.store.createRecord('thing', {
name: thing.name,
description: thing.description
});
thingToSave.save().then(function() {
// happy path
}).catch(function(reason) {
// unhappy path
});
}
}
});
In my template, I have the following:
<div class="error">
</div>
But something isn't quite wired up right. I'm unclear on how the route's model ends up being the thing
I'm trying to save so that the errors will render when the bad path
triggers.
Aucun commentaire:
Enregistrer un commentaire