How to create a validation multi-type with ng-messages


#1

Inspired by the facebook registration form, would create a field that was possible to insert e-mail or phone and my validation messages were personalized, brought the controller, for example.

<label class="item item-input item-stacked-label">
    <span class="input-label">Email</span>
    <input type="text" name="email_tel" placeholder="john@suhr.com ou 4199776565" />
</label>

<div class="form-errors" ng-show="signupForm.email_tel.$error && signupForm.$submitted" ng-messages="signupForm.email_tel.$error" ng-messages-include="templates/validations/signup-email_tel.html">

    <div class="form-error" ng-messages="signupForm.email_tel.$error" ng-messages-multiple>
        <div ng-message="required">
	    {{ ::validations.required }}
        </div>
        <div ng-message="minlength">
	    {{ ::validations.minlength }}
        </div>
        <div ng-message="maxlength">
	    {{ ::validations.maxlength }}
        </div>
    </div>

</div>

References:

calendee.com - ngMessages