dimanche 21 août 2016

Error response in ember-data api

My code for saving document to API looks like that

    save(category) {
        category.save().then(() => {
            this.transitionTo('categories');
        }).catch((adapterError) => {
            console.log(category.get('errors').toArray());
            console.log(category.get('isValid'));
        });
    }, 

When API answers is:

{"errors":[{"attribute":"name","message":"This value should not be blank."}]}

then

category.get('isValid')

still returns true.

My question is, how validation errors should looks like?




Aucun commentaire:

Enregistrer un commentaire