入力テキストが 0 ~ 9 の数字のみを受け入れるようにするパターン。
これは私のパターンです:
$scope.onlyNumbers = /[\u0030-\u0039]+/g;
何らかの理由で、「-」のような文字は、宣言した範囲内になくても受け入れられます。
これは私の入力htmlです:
<input style="width:40%;" type="text" name="phone" ng-minlength="10" ng-maxlength="15" ng-model="register.phone" placeholder='cell phone' ng-pattern="onlyNumbers" required title="please enter cell phone">
誰か助けてくれませんか?