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

热点内容
app几年出 浏览:698
联想家悦er302怎么升级 浏览:924
wifi怎么传送数据 浏览:134
kotlinjava混编 浏览:970
旅游产业数据哪里找 浏览:811
如何搭建数据分析团队 浏览:293
交流电压测量程序 浏览:772
debug是什么文件夹 浏览:637
什么文件是索引文件 浏览:466
编程中的伙伴系统是什么意思 浏览:58
在哪里上编程课好 浏览:251
word首页为偶数页 浏览:665
台式机清除开机密码 浏览:143
巨噬细胞流式数据怎么分析 浏览:681
更改默认桌面文件夹路径 浏览:412
会ug编程如何开厂 浏览:542
怎样删除手机微信视频文件在哪里找 浏览:729
接收系统文件 浏览:252
qqjssdk只能弹窗么 浏览:633
linux中拷贝文件夹命令 浏览:784

友情链接