[英]How to hide option value using ng-if condition in Angular JS
我有一個輸入表單。 如果條件為真,我要比較並顯示值的兩個輸入字段。 輸入字段是:
<td class="td_label"><label>Client Age :</label></td>
<td class="td_input"><input type="text" required="required" class="age" ng-model="age" name="age" maxlength="2">
</td>
<td class="td_label"><label>Test Age :</label></td>
<td class="td_input"><input type="number" required="required" class="libr" ng-model="libr" name="libr" min="50" max="100">
</td>
<td class="td_label"><label>Rider Cost :</label></td>
<td class="td_select"><select ng-model="rider" name="rider" required>
<option value="">Please Select</option>
<option value="0.0001">Option 1 - 3% No Rider</option>
<option value=".75">Option 2 - IAV 5.5% Rider .75%</option>
<option value=".9">Option 3 - IAV 6.0% Rider .90%</option>
<option value=".85">Option 4 - IAV 5.5% Rider .85%</option>
<option value="1.0">Option 5 - IAV 6.0% Rider 1.0%</option>
</select></td>
現在,如果差異測試年齡大於10歲,我希望選擇選項中的第三個選項不適用。 我能做什么 ?
在這種情況下,您可以簡單地使用ngHide :
<option value=".9" ng-hide="libr && age && (libr - age > 10)">Option 3 - IAV 6.0% Rider .90%</option>
只需對要隱藏的DOM使用ng-hide="age - libr > 10"
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.