I have an input with a material autocomplete component linked to it. as the user types calls are made to the server for results. its working fine as the server returns the results in order (for now) But I still would like to cancel the last call before triggering the next one. this is the method I'm using now:
getCodigosPon(needle: string): Observable<any> {
if (needle.length > 3) {
const options = createRequestOption({ idPon: needle });
return this.http.get<string[]>(this.codigoPonUrl, { params: options, observe: 'response' });
} else {
return of([]);
}
}