AngularJS Typeahead显示对象
我正试图让我的应用程序在我的一个视图中有一个提前打印控件。 目前,我已将其设置为与此示例完全相同: 但是为了满足我的需要,我必须让它在下拉列表中显示整个对象。 我的阵列看起来有点像这样:AngularJS Typeahead显示对象,angularjs,Angularjs,我正试图让我的应用程序在我的一个视图中有一个提前打印控件。 目前,我已将其设置为与此示例完全相同: 但是为了满足我的需要,我必须让它在下拉列表中显示整个对象。 我的阵列看起来有点像这样: self.tests = [ { "detail": "27/06/2015, 1 Lines, £478.40", "title": "HOM026MA01|ww06-1526", "type": "O", "value": "W066
self.tests = [
{
"detail": "27/06/2015, 1 Lines, £478.40",
"title": "HOM026MA01|ww06-1526",
"type": "O",
"value": "W0669090"
},
{
"detail": "25/06/2015, 3 Lines, £1390.92",
"title": "BER0050000|andrew02",
"type": "O",
"value": "W0667777"
}
];
因此,我将我的html更改为:
<input type="text" placeholder="Search" ng-model="controller.selected" typeahead="stuff as stuff.value for stuff in controller.tests | filter:$viewValue" />
如您所见,这将显示json对象的值,但我希望它也显示其他细节。
有人知道怎么做吗?您可以在这里简单地使用字符串连接
<input type="text" placeholder="Search"
ng-model="controller.selected"
typeahead="stuff.value + ' ' + stuff.title + ' '+ stuff.detail for stuff in controller.tests | filter:$viewValue" />
显示其他详细信息
是什么意思?你想展示什么样的房产,,