我试图建立一个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
。 有没有干净的方式来做到这一点只用输入?