我正在尝试设置一个typeahead
使用AngularJS和UI 引导程序,如下所示:
.html
<input type="text" ng-model="selectedStuff" typeahead="stuff.name for stuff in stuffs | filter:$viewValue"/>
<span>{{selectedStuff.name}}</span>
<span>{{selectedStuff.desc}}</span>
.js
$scope.stuffs= [
{
"name":"thing1",
"desc":"this is the first thing"
},
{
"name":"thing2",
"desc":"this is the second thing"
}
]
目前,我已经能够使用所选名称更新模型,但我的目标是通过typeahead
. 有没有一种只使用输入的干净方法来做到这一点?