ng-fab-form
ng-fab-form copied to clipboard
validate field without required attribute
Hi,
How can I validate email address when there is no "required" attribute
This does not display invalid email:
<input type="email" class="form-control" placeholder="Email" ng-model="formData.email" >
This displays invalid email but field is required, when I want it optional.
<input type="email" class="form-control" placeholder="Email" ng-model="formData.email" required >
I tried this which is a step closer, However when the form initially appears it is already ticked. It does not seem to matter what is the ng-required field.
<input type="email" class="form-control" placeholder="Email" ng-model="formData.email" ng-required="formData.email.length > 0" >