導航:首頁 > 編程語言 > 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看 瀏覽:196
電腦版上傳視頻找不到文件在哪 瀏覽:164
javastringtemplate 瀏覽:594
聯想啟天m7300能升級內存嗎 瀏覽:698
精雕怎麼打開圖片文件 瀏覽:161
ug編程鏜孔g76如何使用 瀏覽:719
7歲到18歲少兒編程學什麼 瀏覽:413
mac文件怎麼列印 瀏覽:756
農葯登記許可證查詢哪個網站 瀏覽:857
素材站用什麼網站系統 瀏覽:173
ug如何用鉸刀編程 瀏覽:647
三國志版本介紹 瀏覽:260
情侶用的定位app有哪些 瀏覽:244
怎麼清楚蘋果手機的健身數據 瀏覽:988
淘寶美工教程自學網 瀏覽:452
父子2006未刪減版本 瀏覽:872
包頭誰賣蘋果6 瀏覽:504
化工企業停工有哪些文件通知要求 瀏覽:878
下載軟體後文件夾在桌面 瀏覽:397
word文字編組 瀏覽:167

友情鏈接