【发布时间】:2013-04-15 14:17:45
【问题描述】:
我正在尝试使用AngularJS 和UI Bootstrap 设置typeahead,如下所示:
.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 传递整个对象。有没有一种只使用输入的干净方法?
【问题讨论】:
标签: angularjs bootstrap-typeahead angular-ui-bootstrap