导航:首页 > 编程语言 > 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里判断相关的资料

热点内容
监控网络带宽测算 浏览:542
网络ip电话怎么使用 浏览:379
怎么用cad编数控火焰切割编程 浏览:969
有什么app可以一起看电视剧的 浏览:539
什么app有几万人的群 浏览:101
哪个小说app看辰东小说 浏览:664
qq有种红包y上两点 浏览:798
没学历的怎么学编程 浏览:906
无线桥接网络不稳定如何解决 浏览:284
孩子要学编程怎么办 浏览:635
matlab调用c程序心得 浏览:921
史记台湾版本 浏览:397
iphone文件可以存到u盘吗 浏览:327
肖战家中直播用的什么app 浏览:2
spring下载文件名乱码 浏览:575
有哪些下载大学课件的网站 浏览:615
linux怎样删除非空文件 浏览:628
网络电台如何实时播放 浏览:660
职业技术学院学编程怎么样 浏览:569
按键精灵哪个版本好用 浏览:896

友情链接