I have a ticket model with only a subject and content field.
subject: DS.attr('string'),
content: DS.attr('string')
On a new wiew, submitting a new ticket with content but without a subject return the following error :
{"errors":[{"source":{"pointer":"/data/attributes/subject"},"detail":"doit être rempli(e)"}]}`
Here is the controller action :
saveTicket(ticket){
let promise=ticket.save();
promise.then(
() => this.transitionToRoute('tickets')
);
return promise;
}
ticket.errors.subject[0].subject
correctly contain the detail from the server's answer, however, ticket.errors.subject[0].message
also contain the error message.
Why is the error attached to every field ?
Aucun commentaire:
Enregistrer un commentaire