导航:首页 > 编程语言 > ngif在js里判断

ngif在js里判断

发布时间:2024-12-14 19:05:04

㈠ Angularjs 中 ng-if 能不能进行多条件判断

当然可以,你可以网络一下,有很多的,包括elseif的用法,就不详细说了。

㈡ angularjs 手机验证怎么写

第一种方法:

<div class="form-group">
<label for="email" class="col-sm-4 control-label">电话:</label>
<div class="col-sm-4">
<input class="form-control" id="tel" placeholder="请输入电话" type="tel" name="tel"
ng-model="userdata.tel" ng-minlength="11" ng-maxlength="11" ng-pattern="/^1[3|5][0-9]\d{4,8}$/"required>
</div>
<div class="col-sm-4">
<p class="glyphicon glyphicon-ok input_result text-success"
ng-if="signUpForm.tel.$valid"></p>
<p class="text-danger glyphicon glyphicon-remove"
ng-if="signUpForm.tel.$error.required&&signUpForm.tel.$touched">电话不能为空!</p>
<p class="text-danger glyphicon glyphicon-remove"
ng-if="(signUpForm.tel.$error.minlength||signUpForm.tel.$error.maxlength)&&signUpForm.tel.$touched">请输入有效手机号!</p> <!--$touched失去焦点再做判断-->
</div>
</div>
第二种方法:
<div class="form-group">
<label for="email" class="col-sm-4 control-label">电话:</label>
<div class="col-sm-4">
<input class="form-control" id="tel" placeholder="请输入电话" type="tel" name="tel"
ng-model="userdata.tel" ng-minlength="11" ng-maxlength="11" ng-pattern="/^1[3|5][0-9]\d{4,8}$/"required>
</div>
<div class="col-sm-4">
<p class="glyphicon glyphicon-ok input_result text-success"
ng-if="signUpForm.tel.$valid&&signUpForm.tel.$error.pattern"></p>
<p class="text-danger glyphicon glyphicon-remove"
ng-if="signUpForm.tel.$error.required&&signUpForm.tel.$touched">电话不能为空!</p>
<p class="text-danger glyphicon glyphicon-remove"
ng-if="(signUpForm.tel.$error.minlength||signUpForm.tel.$error.maxlength)&&signUpForm.tel.$error.pattern&&signUpForm.tel.$touched">请输入有效手机号!</p>
<!--$touched失去焦点再做判断-->
</div>
</div>
第三种完全正确:(推荐)
<div class="form-group">
<label for="email" class="col-sm-4 control-label">电话:</label>
<div class="col-sm-4">
<input class="form-control" id="tel" placeholder="请输入电话" type="tel" name="tel"
ng-model="userdata.tel" ng-minlength="11" ng-maxlength="11" ng-pattern="/^1[3|5][0-9]\d{4,8}$/"required>
</div>
<div class="col-sm-4">
<p class="glyphicon glyphicon-ok input_result text-success"
ng-if="signUpForm.tel.$valid"></p>
<p class="text-danger glyphicon glyphicon-remove"
ng-if="signUpForm.tel.$error.required&&signUpForm.tel.$touched">电话不能为空!</p>
<p class="text-danger glyphicon glyphicon-remove"
ng-if="(signUpForm.tel.$error.minlength||signUpForm.tel.$error.maxlength||signUpForm.tel.$error.pattern)&&signUpForm.tel.$touched">请输入有效手机号!</p>
<!--$touched失去焦点再做判断-->
</div>
</div>

阅读全文

与ngif在js里判断相关的资料

热点内容
三星电视拆机教程 浏览:19
创维怎么连接网络 浏览:868
2007版word绘图在哪里 浏览:311
可以拍车牌的app是什么 浏览:508
文件加个井字号什么意思 浏览:155
怎么删除多重网络 浏览:999
求生之路2局域网联机工具 浏览:827
说明文件结尾用什么词 浏览:578
发送的文件名变数字 浏览:778
档案数据库管理 浏览:992
微信acl是金融传销吗 浏览:620
企业如何通过进行网络营销 浏览:551
微信json转换错误 浏览:364
拉勾勾是什么网站 浏览:556
长沙哪个学校有大数据技术与应用 浏览:137
qq语音停止运行 浏览:312
java获取系统当前时间并转为秒 浏览:679
linux目录文件数 浏览:994
ug如何用宏编程 浏览:857
在编程中P代表什么 浏览:420

友情链接