如何交出 ng-bootstrap typeahead 的选项列表

How to hand over the List of options for a ng-bootstrap typeahead

我想为我的很多输入实现 ng-bootstrap 的预输入。我能以某种方式交出选项数组吗?

问题是,ngbTypeahead 期望像这样传递一个带有一个参数的函数:

<input [(ngModel)]="model" [ngbTypeahead]="search"/>
search = (text$: Observable<string>) =>

我需要更改它,以便我也可以提交选项数组。 我该怎么做?

<input [(ngModel)]="model" [ngbTypeahead]="search(observable, options)"/>
search = (text$: Observable<string>) =>

我找到了解决方案。

我创建了另一个函数 returns 搜索函数,它仍然只需要一个参数:

typeAheadResultFunction(hc: HeaderColumn): (text: Observable<string>) => Observable<string[]>{
    return (text$: Observable<string>) => text$ ...
}