實例如下:
<form name="signUpForm" novalidate> <div class="form-group"> <div class="row clearfix"> <label for="tel1" class="col-xs-12" style="text-align: left">L張蒙號碼1:</label> <div style="text-align: center" class="col-xs-12"> <input id="tel1" type="tel" name="tel1" data-ng-model="vm.tel1" ng-minlength="11" ng-pattern="/^1[3|5][0-9]/d{4,8}$/" required style="width: 80%;font-size: large" placeholder="請輸入號碼1:"/> </div> <div class="col-xs-12"> <p class="glyphicon glyphicon-ok input_result text-success" ng-if="signUpForm.tel1.$valid"></p> <p class="text-danger glyphicon glyphicon-remove" ng-if="signUpForm.tel1.$error.required&&signUpForm.tel1.$touched">電話不能為空!</p> <p class="text-danger glyphicon glyphicon-remove" ng-if="(signUpForm.tel1.$error.minlength||signUpForm.tel1.$error.maxlength||signUpForm.tel1.$error.pattern)&&signUpForm.tel1.$touched">請輸入有效手機號!</p> </div> </div></form>以上這篇AngularJs 最新驗證手機號碼的實例,成功測試通過就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。
新聞熱點
疑難解答