【发布时间】:2017-02-24 21:44:14
【问题描述】:
我正在关注 official angular documentation ,但它对我不起作用。有什么问题?我需要验证是否需要手机并遵循 +4400000000 等国际标准(加上信号和数字,没有空格,只有加号后的数字)。
我的代码是....
.controller('ModalInstanceChangeDetailsCtrl', function ($scope, $rootScope, $uibModalInstance, items) {
$scope.rxMobile = '^\+[1-9]{1}[0-9]{3,14}$';
}
<form name="form">
<div class="form-group">
<label>Mobile number</label><label class="fieldError" ng-show="form.mobile.$error.required || !form.mobile.$valid">This field is required and must use International format, ex: +440000000000</label>
<input ng-pattern="rxMobile" required ng-model="mobile" name="mobile" type="text" class="form-control">
</div>
</form>
有什么建议吗?
【问题讨论】:
标签: javascript angularjs regex angularjs-forms