Delete ng-sent after successful submission

I have a form that is submitted via api and can be reused immediately after the completion of the submit request.

For verification styling requirements, I need to remove the css ng-submitted class from <form> , I cannot find an angular way to clear it or reset the form.

I tried:

 myForm.$submitted = false; 

but this does not remove the ng-submitted class

Is there such a method in angular 1.3?

+6
source share
1 answer

Hi, I think you need to do this:

 myForm.$setPristine(); myForm.$setUntouched(); 

this will clear the send state and all fields will not be affected, it will not clear the field values, although if you want you to need to do this separately

+9
source

Source: https://habr.com/ru/post/983374/


All Articles