0
I am creating a form with Ionic and want to validate the fields after the submitted form. As I am doing, it works, but when I open the page the fields are already marked as invalid and I want that to happen after the form is submitted if there is some field that has not been filled.
How do I do that ?
I’m trying like this.
<form name="Empresa" novalidate ng-submit="addEmpresa(Empresa);">
<div class="list">
<label class="item item-input"
ng-class="{'has-errors':Empresa.nomeemp.$invalid, 'no-errors':Empresa.nomeemp.$valid}">
<input type="text"
placeholder="Nome"
name="nomeemp"
ng-model="Empresa.nome"
ng-required="true">
</label>
<div class="error-container"
ng-messages="Empresa.nomeemp.$error">
<div ng-messages-include="templates/form-errors.html"></div>
</div>
<button type="submit" class="button button-block button-energized">Cadastrar</button>
</form>