Commit 1ee6ab4e9561f7dc35b64cef60a0cc6f1abc3143
1 parent
01f3e07a6f
Exists in
master
and in
1 other branch
host listener
Showing
3 changed files
with
21 additions
and
1 deletions
Show diff stats
package-lock.json
| ... | ... | @@ -7843,6 +7843,11 @@ |
| 7843 | 7843 | "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", |
| 7844 | 7844 | "dev": true |
| 7845 | 7845 | }, |
| 7846 | + "simple-keyboard": { | |
| 7847 | + "version": "2.25.3", | |
| 7848 | + "resolved": "https://registry.npmjs.org/simple-keyboard/-/simple-keyboard-2.25.3.tgz", | |
| 7849 | + "integrity": "sha512-wEEPPbVUH8C4pzION3ROyJWuf079FtEpYi6VciDgKB77BzKsQsH9sBimCn4b+1Qsk7krYTzNOYUshbWLzSb+6A==" | |
| 7850 | + }, | |
| 7846 | 7851 | "slash": { |
| 7847 | 7852 | "version": "1.0.0", |
| 7848 | 7853 | "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", |
package.json
src/app/components/inicio/inicio.component.ts
| ... | ... | @@ -6,7 +6,7 @@ import { ProductoService } from 'src/app/services/producto.service'; |
| 6 | 6 | import { Router } from '@angular/router'; |
| 7 | 7 | import { Promocion } from 'src/app/wrappers/promocion'; |
| 8 | 8 | import { Sinonimo } from 'src/app/wrappers/sinonimo'; |
| 9 | - | |
| 9 | +import { HostListener } from '@angular/core'; | |
| 10 | 10 | |
| 11 | 11 | @Component({ |
| 12 | 12 | selector: 'app-inicio', |
| ... | ... | @@ -15,11 +15,16 @@ import { Sinonimo } from 'src/app/wrappers/sinonimo'; |
| 15 | 15 | }) |
| 16 | 16 | export class InicioComponent implements OnInit { |
| 17 | 17 | |
| 18 | + @HostListener('document:keypress', ["$event"]) catchInput(e: KeyboardEvent) { | |
| 19 | + this.busqueda += e.key; | |
| 20 | + }; | |
| 21 | + | |
| 18 | 22 | @ViewChild('pop', { static: false }) popoverDirective: PopoverDirective; |
| 19 | 23 | private productoAcargar: Producto; |
| 20 | 24 | private promoAcargar: Promocion; |
| 21 | 25 | private tienePromo = false; |
| 22 | 26 | private productoEsPromo = false; |
| 27 | + private busqueda: string = ''; | |
| 23 | 28 | |
| 24 | 29 | promociones: Promocion[] = []; |
| 25 | 30 | sinonimos: Sinonimo[] = []; |
| ... | ... | @@ -31,6 +36,8 @@ export class InicioComponent implements OnInit { |
| 31 | 36 | |
| 32 | 37 | ngOnInit() { |
| 33 | 38 | |
| 39 | + this.vaciarBusqueda(); | |
| 40 | + | |
| 34 | 41 | this.productoAcargar = this.productoService.productoAcargar; |
| 35 | 42 | if (this.productoAcargar) { |
| 36 | 43 | var sector = this.productoAcargar.CodSec; |
| ... | ... | @@ -94,4 +101,11 @@ export class InicioComponent implements OnInit { |
| 94 | 101 | } |
| 95 | 102 | } |
| 96 | 103 | |
| 104 | + vaciarBusqueda() { | |
| 105 | + | |
| 106 | + setTimeout(() => { | |
| 107 | + this.busqueda = ''; | |
| 108 | + }, 2000); | |
| 109 | + } | |
| 110 | + | |
| 97 | 111 | } |