我正在使用特定編輯表單頁面中的選擇列表。無論何時需要編輯某個特定條目,都會顯示帶有編輯表單的新狀態。它有一個選擇列表,必須填入其中一個選項(理想情況下,使用API從服務器獲取的值必須填充到選擇列表中)。如何在AngularJS的選擇(HTML)列表中填充值
我在客戶端使用Angular JS。有人能告訴我如何使用Angular JS實現相同的功能嗎?
我需要用戶在select中插入的初始值在編輯頁面打開時顯示爲默認值。
(此外,我國佔位符不工作: 「選擇國家」)
比方說,有這樣的事情:
<div class="col-md-8">
<select data-placeholder="Choose a Country..." class="chosen-select form-control" style="width:350px;" tabindex="2" required="" ng-model="location">
<option value="" disabled selected>Select</option>
<option ng-repeat="location in locations1" value="{{location.id}}">{{location.name}}</option>
</select>
</div>