Я хочу реализовать автозаполнение в одном из текстовых полей. Я пытаюсь использовать начальную загрузку, следуя этому простому примеру.
https://ng -bootstrap.github.io / # / компоненты / машинописный / примеры # основной
Однако я получаю следующую ошибку при компиляции.
ERROR in C:/Users/eclipse-workspace/c-UI/src/app/send-email/send-email.component.ts (33,24): Property 'length' does not exist on type '{}'.
ERROR in C:/Users/eclipse-workspace/c-UI/src/app/send-email/send-email.component.ts (34,59): Property 'toLowerCase' does not exist on type '{}'.
HTML
<input type="text" class="form-control" [ngbTypeahead]="states">
component.ts
import { Component} from '@angular/core';
import {debounceTime, distinctUntilChanged, map} from 'rxjs/operators';
const states = ['Alabama', 'Alaska', 'American Samoa'];
export class SendEmailComponent {
public model: any;
search = (text$: Observable<string>) =>
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
map(term => term.length < 2 ? []
: states.filter(v => v.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10))
)
}
Пожалуйста, помогите.