0
私はng-bootstrap 4(beta 8)を使用しています。現時点で私はこれを持っています:ngブートストラップ4 - 先読みが開いている
<ng-template #rt let-r="result" let-t="term">
{{ r.label }}
</ng-template>
<input
id="typeahead-focus"
class="form-control"
[(ngModel)]="model"
[ngbTypeahead]="search"
[inputFormatter]="formatter"
[resultTemplate]="rt"
(focus)="focus$.next($event.target.value)"
(click)="click$.next($event.target.value)"
#instance="ngbTypeahead"
/>
ここで、ユーザーが入力要素をクリックすると、私は先頭を開きたいと思います。これどうやってするの?
this.search = (text$) =>
text$
.map(term => (term === '' ? this.items : this.items.filter(v => v.label.toLowerCase().indexOf(term.toLowerCase()) > -1)).slice(0, 10));
this.formatter = (x: {label: string}) => {
console.log(x);
return x.label;