我正在开展一个项目,当你选择"其他"时,需要显示一个文本框。该国的字段和货币下拉列表。这是我尝试过的。
当我选择"其他"时,如何显示文本框?来自国家或货币下拉?我在很多方面尝试了它,但不知怎的,它没有用。
答案 0 :(得分:0)
在div中使用ng-show="country=='OTHER'"
和ng-show="currency=='OTHER'"
来获得所需的结果。
<div class="row">
<div class="field">
<label>Select Country</label>
<select ng-model="country">
<option value="">-- Select a Country --</option>
<option ng-repeat="country in countries" value="{{country.code}}">{{country.name}}</option>
</select>
</div>
<div class="field">
<label>Select Currency</label>
<select ng-model="currency" onchange='CheckCurrency(this.value);'>
<option value="">-- Select a Currency --</option>
<option ng-repeat="currency in currencies" value="{{currency.code}}">{{currency.name}}</option>
</select>
</div>
</div>
<div class="row">
<div class="field" ng-show="country=='OTHER'">
<input type="text" name="country" id="country"/>
</div>
<div class="field" ng-show="currency=='OTHER'">
<input type="text" name="currency" id="currency"/>
</div>
</div>
在这里检查plunker:https://plnkr.co/edit/2EmN4b?p=preview