angular material - angularjs single input filed for both email and mobile number -


in registration form have single field both email , mobile number doesn't working properly.

<form name="regform" > <md-input-container flex md-no-float>    <input ng-model="vm.form.email" type="text" placeholder="email or phone" translate translate-attr-placeholder="register.email" name="email or phone" ng-pattern="/^([_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5}))|\d+$/"  required="true">    <div ng-messages="regform.email.$error" ng-show="regform.email.$touched">      <div ng-message="required">this field required</div>      <div ng-message="email">your email address invalid</div>    </div> </md-input-container> </form> 

below code showing schema in model file

usermodel.js

var userschema = new schema({    name: string,    email: {type: string, required: true, select: true},    password: {type: string, required: true, select: true}, }); 

the field you're trying reference in ng-messages , ng-show not exist (there no input name="email" within regform).

for trying achieve i'd use custom validation logic here. might use custom validator described in docs.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -