0
我們在我們的應用程序中使用AngularJS v1.5.8。我正在尋找一種方法來顯示下拉菜單,但也允許輸入新的值。我已經檢查了這個Manually type in a value in a "Select"/Drop-down HTML list?並試過datalist(在Google Chrome中沒有工作),也查看了http://selectize.github.io/selectize.js/和http://jsfiddle.net/69wP6/4/我想知道angularJ是否已經存在,所以我不會重新發明輪子。AngularJS下拉式輸入值的能力
我當前的代碼是這樣的
<input type="text" name="newRowValue" id="newRowValue" class="form-control"
list="rowValues" ng-model="newRowValue"
placeholder="@Labels.typeOrSelect"/>
<datalist id="rowValues" name ="rowValues"
class="form-control" ng-model="rowValue">
<option ng-repeat = "possibleValue in metaData.allPossibleValues| filter: {attributeId: currentMatrixTemplate.rowAttributeId}"
value="{{possibleValue.attributeId}}" ng-show="possibleValue.hidden==false || showHidden">{{possibleValue.valueName}}
</option>
</datalist>
不在Chrome中正確顯示。任何想法都可以通過輸入新值的方式輕鬆實現?
謝謝,看起來像我需要http://angular-ui.github.io/ui-select/ - 將嘗試它。 – Naomi
我檢查過文檔和樣本,但沒有看到我的案例。我需要能夠選擇一個值,也可以鍵入值,並能夠添加該值 – Naomi
@naomi看看這個頁面:http://angular-ui.github.io/ui-select/demo-select2-與-bootstrap.html。這是新版本,但看起來像舊的。 – Ben