recipes-with-angular-js-examples icon indicating copy to clipboard operation
recipes-with-angular-js-examples copied to clipboard

server side validations

Open cleesmith opened this issue 11 years ago • 1 comments

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

cleesmith avatar Nov 27 '13 13:11 cleesmith

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);

JoshuaNovak919 avatar Feb 12 '14 00:02 JoshuaNovak919