>我正在尝试屏蔽格式为 xxx-xxx-xxxx 的数字,并试图确保电话号码从除 0 和 1 以外的任何数字开头
<div class="form-group" data-ng-class="{ 'error' : editForm.homePhone.$invalid && editForm.$dirty }">
<label class="label" for="homePhone">Home Phone</label>
<input name="homePhone"
data-ng-model="edit.HomePhoneNumber"
required
ng-pattern="/^[2-9]{1}[0-9]{2}-[0-9]{3}-[0-9]{4}$/"
ui-mask="999-999-9999" ui-mask-placeholder />
<span>{{editForm.homePhone}}</span>
<span class="error-message field-validation" data-ng-show="editForm.homePhone.$invalid && editForm.homePhone.$dirty">
Phone number must be in the format xxx-xxx-xxxx
</span>
</div>
它总是说数字无效。我尝试打印编辑表单.homePhone
我确实检查了堆栈溢出上的所有帖子。试过了,但没有去。不确定什么是不正确的?
我正在使用 ui-utils.js - v0.1.1 用于 ui-mask
问题似乎是 ui-utils.js v0.1.1
我直接包含了ui-mask,它工作正常:http://codepen.io/emed/pen/GqqmKW
(tested with angular 1.5.5 and ui-mask 1.8.5)
https://github.com/angular-ui/ui-mask