The correct way to restore and validate an angular form is with ng-messages
angular.module("seuApp", ["ngMessages"]);
Where your form
is referenced in controller
for name
example...
<form name="teste">
<input class="form-control" type="text" ng-model="testes.nome" name="nome" placeholder="Nome" ng-required="true" ng-minlength="10"/>
</form>
<div ng-messages="teste.nome.$error" class="alert alert-danger">
<div ng-message="required">
Por favor, preencha o campo nome!
</div>
<div ng-message="minlength">
O campo nome deve ter no mínimo 10 caracteres.
</div>
</div>
After submission the same must be restored with setPristine
$scope.add = function (el) {
$scope.testes.push(angular.copy(el));
delete $scope.el;
$scope.teste.$setPristine();
};
Are you using what kind of validation?
– Felipe Duarte
You cannot trigger the occultation of the elements in the response of this call ?
– AnthraxisBR
how to trigger?
– wDrik
use direct angular validation =>
ng-show="contactForm.nome.$invalid && !contactForm.nome.$pristine"
– wDrik