導航:首頁 > 編程語言 > 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里判斷相關的資料

熱點內容
什麼網站看港漫好用 瀏覽:618
照相機視頻的文件夾 瀏覽:205
照片怎樣用cad轉成cad文件 瀏覽:822
有兩個網站如何操作 瀏覽:499
excel怎麼把兩個表格中的數據導入 瀏覽:530
什麼是一二一二三APP 瀏覽:877
cs6的魔棒工具 瀏覽:243
文件夾變成受系統保護 瀏覽:479
雨林木風系統安裝教程win7 瀏覽:886
黨中央文件有哪些 瀏覽:872
關於頁眉頁腳文件圖片 瀏覽:147
editbin文件 瀏覽:199
手機怎麼編寫文件到qq 瀏覽:483
蘋果5怎麼樣清理內存 瀏覽:870
win7屏保文件 瀏覽:784
agk什麼文件 瀏覽:441
安卓app編程用什麼 瀏覽:222
文件下載路徑設置不可用 瀏覽:192
win7打不開本地視頻文件 瀏覽:740
怎麼解壓targz文件 瀏覽:358

友情鏈接