私はofficial angular documentationに従っていますが、それは私には役に立たないです。何が間違っていますか?私は携帯電話が必要で、+4400000000のような国際標準に従っているかどうかを検証する必要があります(プラス信号と数字、スペースなし、プラスの後の数字のみ)。フォームフィールドをregExで角度を検証する
私のコードは....
.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>
任意の提案ですか?
SyntaxError:無効な正規表現:/ ^^ + d {10} $ /:何も繰り返しません new RegExp()--- $ scope.rxMobile = "^ \ + \ d {10} \ b" ; –
@MarcoJr check edit – m87