Commit ccc4d9fa3f1e1d86b49a4c7d30ecacfde90dc1c9
1 parent
9fc6482d75
Exists in
master
Ocultar spinner si ocurre un error.
Showing
2 changed files
with
3 additions
and
2 deletions
 
Show diff stats
src/app/components/busqueda-productos/busqueda-productos.component.html
| ... | ... | @@ -103,7 +103,7 @@ | 
| 103 | 103 | </div> | 
| 104 | 104 | |
| 105 | 105 | <!-- SPINNER --> | 
| 106 | - <div *ngIf="productos.length === 0" class="col-sm-10 align-self-center"> | |
| 106 | + <div *ngIf="productos.length === 0 && showSpinner" class="col-sm-10 align-self-center"> | |
| 107 | 107 | <div class="spinner-border spinner-lg text-secondary" role="status"></div> | 
| 108 | 108 | <span class="text-secondary m-2 h5">Cargando información.</span> | 
| 109 | 109 | </div> | 
src/app/components/busqueda-productos/busqueda-productos.component.ts
| ... | ... | @@ -12,6 +12,7 @@ export class BusquedaProductosComponent implements OnInit { | 
| 12 | 12 | productos: Producto[] = []; | 
| 13 | 13 | auxProductos: Producto[] = []; | 
| 14 | 14 | searchTerm: string = ''; | 
| 15 | + showSpinner: boolean = true; | |
| 15 | 16 | |
| 16 | 17 | constructor(private productoService: ProductoService) { } | 
| 17 | 18 | |
| ... | ... | @@ -22,7 +23,7 @@ export class BusquedaProductosComponent implements OnInit { | 
| 22 | 23 | |
| 23 | 24 | this.auxProductos = this.productos = data; | 
| 24 | 25 | }, (error) => { | 
| 25 | - | |
| 26 | + this.showSpinner = false; | |
| 26 | 27 | console.error(error); | 
| 27 | 28 | }); | 
| 28 | 29 | } |