0
Hello. I have a routine that checks the elements of a form-group and adds the class has error in the form-validate. Below
var allElements = element.find("input");
for(var i = 0; i < allElements.length; i++) {
var field = angular.element(allElements[i]);
if(field.parent().parent().hasClass('has-error')){ field.parent().parent().removeClass('has-error');
}
}
AND THE FORM-GROUP IS LIKE THIS
<div class="form-group">
<div class="input-group plain-addon">
<div class="input-group-addon"><span class="fa fa-user fa-fw"></span></div>
<input type="text" ng-model="user.nickname" class="form-control" placeholder="Nome" name="nickname" required>
</div>
<span class="help-block"><span class="help-block">Campo obrigatório</span></span>
</div>
I need now to hide the mandatory camp and only show when has error. I’m starting now on Angularjs