Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ember-validators with server validation errors
MyController = Ember.Controller.extend({
actions: {
save: function() {
this.get('model').save().then(function() {
// Success, maybe transitionToRoute or whatever
}, function(xhr) {
// Oh noes, we had an error, maybe it's a validation error
if (xhr.status == 400) {
$.parseJSON(xhr.responseText).each(function(attribute, errors) {
this.get('errors').set(attribute, errors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.