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

熱點內容
u盤驅動在哪個文件夾里 瀏覽:938
華為手機跟蘋果手機怎麼克隆app 瀏覽:172
cad文件為什麼顯示文件名是否正確 瀏覽:174
程序配置文件能自動轉換成txt 瀏覽:985
r4燒錄卡不同版本 瀏覽:962
怎麼升級qq群為2000 瀏覽:347
微信己冊除的文件怎樣找回來 瀏覽:715
蘋果美國賬號共享2017 瀏覽:252
ps文件修改後打開還是原圖 瀏覽:220
燒卡機蘋果4微信qq哪裡下載 瀏覽:780
ug120找不到指定文件 瀏覽:522
cda文件怎麼轉換成mp3格式 瀏覽:702
青島hpv疫苗在哪個app預約 瀏覽:881
雙十一成交額2021數據在哪裡看 瀏覽:631
蘋果手機怎麼打開移動數據 瀏覽:637
文件掃描成圖片是彩色的嗎 瀏覽:50
編程里的comply什麼意思 瀏覽:91
電腦上面點了禁用網路怎麼改回來 瀏覽:28
javacatch執行 瀏覽:182
ps軟體文件名字 瀏覽:184

友情鏈接