Angular Material, Autocomplete loading indicator and showing text (no results found)
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 91
Descripción
#### 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.
Guía de contribución
Línea de trabajo
Comience con la plantilla de Angular proporcionada y la canalización valueChanges de ngOnInit; después, revise la documentación de autocompletado de Angular Material y los ejemplos relacionados. Se considera terminado cuando el autocompletado indica visiblemente que hay una búsqueda en curso y muestra un mensaje de que no hay resultados cuando el resultado asíncrono está vacío; no se menciona ningún archivo ni prueba del repositorio.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- angular, typescript
- Área
- frontend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Tranquilo
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 38/100