标签:type pre bsp 正则表达 匹配 isa orm log amp
代码:
<form ng-app="myApp" ng-controller="validateCtrl" name="myForm" novalidate> <p>电话:<br> <input type="text" name="phone" ng-model="phone" ng-pattern="/(^$)|^(((\+86)|(86))?1[34578]\d{9})$/"> <span style="color:red" ng-show="myForm.phone.$dirty && myForm.phone.$invalid"> 联系电话格式不正确!</span> </p> <p> <input type="submit" ng-disabled="myForm.$invalid"> </p> </form>
正则表达式:
1. 匹配空:^$
2. 匹配手机号:^(((\+86)|(86))?1[34578]\d{9})$
3. 控制提示信息的显示:ng-show="myForm.phone.$dirty && myForm.phone.$invalid"
标签:type pre bsp 正则表达 匹配 isa orm log amp
原文地址:http://www.cnblogs.com/xquancnblogs/p/7819110.html