角和離子應用清除NG-模型,然後更新NG-模型,新的價值
我有了很多<select>
元素的一種形式,形式爲用戶提供了從列表中選擇或if the <option> = 'Other' then I show another <input>
進入值。然後我將該值保存到另一個ng-model
。
<select data-ng-model="minor.tests.liveEarth"
name="minorTestLiveEarth"
required>
<option></option>
<option>>200</option>
<option>>299</option>
<option>>500</option>
<option>>1000</option>
<option>Other</option>
</select>
</label>
<label class="item item-input item-stacked-label" ng-show="minor.tests.liveEarth === 'Other'">
<span class="input-label">Please Specify</span>
<input type="text"
placeholder="live earth other"
ng-maxlength="10"
data-ng-model="minor.tests.liveEarthOther"
name="minorTestLiveEarthOther">
</label>
我最初使用的是<datalist>
,但不顯示在iOS上。
我分配給liveEarthOther
一樣<select>
活樂地球但它已經分配到NG-模型,則用戶輸入其值之前刪除輸入值Other
'Other'
。
我已經找了一個組合框控件,但沒有找到一個能正常工作的控件。
我怎麼能把它變成一個指令或任何可以執行重命名而不需要用戶刪除值的東西。
我想在我正在構建的應用程序中多次使用此功能。
感謝您的幫助這給了我一個方法來驗證,並指定我的模型。 – StudentRik