在注册表单中,我的电子邮件和手机号码都有一个字段,但它不能正常工作。
<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 is required</div>
<div ng-message="email">Your email address is invalid</div>
</div>
</md-input-container>
</form>
下面的代码显示模型文件中的模式
用户模型.js
var UserSchema = new Schema({
name: String,
email: {type: String, required: true, select: true},
password: {type: String, required: true, select: true},
});