AngularJs 最新验证手机号码的实例,成功测试通过

实例如下:

<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 最新验证手机号码的实例,成功测试通过就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容