I am currently using ng-bootstrap 4 (beta 8) and have the following setup:
<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"
/>
I now want to trigger the opening of the typeahead when the user clicks on the input element. How can I achieve this?
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;