When I start to write in my TypeAhead the option list works but if I delete a character always appear the result of the previous looking for.
<input id="OficinaContablePT"
type="text"
class="form-control"
[(ngModel)] = "model"
[ngbTypeahead]="searchOC"
[inputFormatter]="formatter"
[resultFormatter]="formatter"/>
searchOC = (text$: Observable<string>) =>
text$.pipe(
debounceTime(100),
distinctUntilChanged(),
map(term => term.length < 3 ? this.listaContables = []
: (this.oficinaContable(1, term).filter(v =>
v.codigo.toLocaleLowerCase().indexOf(term.toLocaleLowerCase()) > -1).slice(0, 10)))
)
If I look for "L0103" appear "L0103AZSDF, L0103QWER" but if I delete a character ("L010") must appear "L0101, L0102, L0103ASDF, L010QWER" and only appear "L0103AZSDF, L0103QWER"
Finally I solved it,
To solve it I needed to create a '(ngModelChange)' that charge a static array with my method of search and then use this array in the search component and dont use the method in the search.