使用Elasticsearch和Ng-Bootstrap Typeahead进行自动完成。
我在Chrome控制台中收到此错误:
Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays
我从ES返回的数据如下所示:
{
"hits": {
"total": 21,
"hits": [
{
"_source": {
"suggestions": "bruce willis"
}
},
{
"_source": {
"suggestions": "bruce wayne"
}
},
{
"_source": {
"suggestions": "bruce"
}
},
{
"_source": {
"suggestions": "brian"
}
}
所以我不确定如何调整我的自动完成组件或我的ES服务代码给NgFor命中数组,这只能解决它看起来的问题的一半,因为hits数组是一个对象数组。然后,我如何从"suggestions"
?
_source
的值