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

热点内容
fgets空文件 浏览:857
传奇物品文件夹 浏览:352
word插入excel图表 浏览:690
xp系统搜索不到本地文件 浏览:39
什么网站可以找到拼团去西藏 浏览:247
javatask 浏览:50
MFC的文件名 浏览:972
cad自动保存的文件怎么关闭 浏览:667
zip文件密码多少 浏览:486
编程培训哪些好 浏览:324
如何把文件夹内容变成文档 浏览:509
小火箭幼儿编程怎么拿积分 浏览:158
火车票时刻表及票价数据库 浏览:94
求平均值java 浏览:767
linux如何分屏显示 浏览:257
手机可以直接填写pdf文件么 浏览:554
linux虚拟光驱软件 浏览:836
米2s最好的版本 浏览:640
小米6检测工具下载 浏览:540
桌面创建不了文件夹怎么回事 浏览:894

友情链接