recipes-with-angular-js-examples
recipes-with-angular-js-examples copied to clipboard
server side validations
In chapter9+recipe1+contacts, for example:
- entering "jjj" into the age field causes a validation error
- follow that by entering "123" into to age field should give just that validation error, but instead it shows the previous error plus the current validation error
It's like all validations just get appended in app/javascripts/controllers/ContactsEditCtrl.js in the push within the method errorMessage.
How do you "reset/clear" the validation errors between/before each submit to rails ?
Thanks for the git examples and the book :-) chris
I just had to do this myself. I ended up adding the line:
$scope.form.$setPristine();
To the failure function underneath:
console.log("failure", response);