Open GlauberF opened 4 years ago
Baking this into the autocomplete may be too opinionated since different apps have different ways of showing loading. We should have an example showing how to do it though.
in my use case, this is my implementation and it works perfectly.
I see that there is still a "help wanted" label, is this still the case? Is there a feature to do? Or is it just finding a solution to your use case without modifying Material/autocomplete?
@GlauberF for "how to know that the request inside switchMap(term => this.to.filter(term)) was finished" you can use finalize from rxjs.
For "how to show a registration message not found, when the server returns an empty array" you can do a secondary stream based on result$.
isNotFound$ = this.result$.pipe(map(res => !!res?.length))
Feature Description
I need to show loading when searching for data and also show text when no record is found. I have the following html excerpt:
Component.ts code:
for loading, I would control it with the
tap()
method, but my problem is how to know that the request insideswitchMap(term => this.to.filter(term))
was finished, so I set the loading variable to false?my second problem is how to show a registration message not found, when the server returns an empty array, because I am working with async.