0
我在我的angularjs項目中使用了typeahead
。當我使用typeahead屬性時,文本框無法正常工作
我必須用typeahead
屬性顯示在文本框中以下值:
$scope.cities = [{id:1,address:'Berlin'},
{id:2,address:'Bonn'},
{id:3,address:'London'},
{id:4,address:'Miami'}];
這裏是輸入文本框與typeahead
屬性:
<input type="text"
ng-model="city"
ng-model="initFoo(1)"
uib-typeahead="city as city.address for city in cities | filter:$viewValue"
class="form-control"
typeahead-show-hint="true"
typeahead-min-length="0"/>
這裏是一個plunker。
當初始值設置爲initFoo
時,我無法刪除所選文本框或鍵入文本框。
任何想法如何設置初始值,並保持我的文本框可選和可打印?