Angular Material, Autocomplete loading indicator and showing text (no results found)
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
#### 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:
```html
arrow_drop_down
{{
index !== to.filterKeys.length - 1
? value[ky] + ' - '
: value[ky]
}}
{{ value }}
```
Component.ts code:
```javascript
ngOnInit(): void {
super.ngOnInit();
this._unsubscribeAll = new Subject();
this.isLoading = false;
this.result$ = this.formControl.valueChanges.pipe(
takeUntil(this._unsubscribeAll),
debounceTime(300),
startWith(''),
tap(() => {
this.isLoading = true
}),
switchMap(term => this.to.filter(term))
);
}
```
for loading, I would control it with the `tap()` method, but my problem is how to know that the request inside `switchMap(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.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Partire dal template Angular fornito e dalla pipeline valueChanges di ngOnInit, quindi esaminare la documentazione dell’autocompletamento di Angular Material e gli esempi correlati. Il lavoro è completo quando l’autocompletamento indica visibilmente che è in corso una ricerca e mostra un messaggio di assenza di risultati quando il risultato asincrono è vuoto; non viene indicato alcun file o test del repository.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 38/100