I have a method getData()
inside Angular app which calls on click every time when asc > desc
sorting in the table is changed. If I click it 10 times in a row I will make 10 get request and data will assign to table every time when the request is resolved, so it makes it blinking till the last request. How can I waiting for data only for the last request and ignore another?
this.getData() {
this.endpointsService.getData(reqParams).pipe(
takeUntil(this.ngUnsubscribe$)
).subscribe((data) => {
this.data$.next(data);
}
}
data$ is using in view with *ngFor
*ngFor="let item of (data$ | async)">