Commit d684bd32d2b1dce27c6c2e1a3270061fdf619021
1 parent
7210315444
Exists in
master
and in
1 other branch
Cambio de tipo en objeto sinonimo.
Showing
1 changed file
with
10 additions
and
5 deletions
Show diff stats
src/app/components/popover-sinonimos/popover-sinonimos.component.ts
| 1 | 1 | import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; |
| 2 | 2 | import { PopoverDirective } from 'ngx-bootstrap'; |
| 3 | -import { Sinonimo } from 'src/app/wrappers/sinonimo'; | |
| 3 | +import { Producto } from 'src/app/wrappers/producto'; | |
| 4 | 4 | |
| 5 | 5 | @Component({ |
| 6 | 6 | selector: 'app-popover-sinonimos', |
| ... | ... | @@ -11,13 +11,18 @@ export class PopoverSinonimosComponent implements OnInit { |
| 11 | 11 | |
| 12 | 12 | //Directiva del popover, para poder cerrarlo desde este componente |
| 13 | 13 | @Input() popover: PopoverDirective; |
| 14 | - @Input() popoverContent: Sinonimo[]; | |
| 15 | - @Output() sinonimoSeleccionado = new EventEmitter<Sinonimo>(); | |
| 16 | - sinonimo: Sinonimo; | |
| 14 | + @Input() popoverContent: Producto[]; | |
| 15 | + @Output() sinonimoSeleccionado = new EventEmitter<Producto>(); | |
| 16 | + sinonimo: Producto; | |
| 17 | 17 | |
| 18 | 18 | constructor() { } |
| 19 | 19 | |
| 20 | 20 | ngOnInit() { |
| 21 | + | |
| 22 | + //Seteo en la variable a emitir el sinonimo que sea padre | |
| 23 | + this.popoverContent.forEach(sinonimo => { | |
| 24 | + this.sinonimo = sinonimo.esPadre ? sinonimo : undefined; | |
| 25 | + }) | |
| 21 | 26 | } |
| 22 | 27 | |
| 23 | 28 | hidePopover() { |
| ... | ... | @@ -26,7 +31,7 @@ export class PopoverSinonimosComponent implements OnInit { |
| 26 | 31 | this.popover.hide(); |
| 27 | 32 | } |
| 28 | 33 | |
| 29 | - setSinonimo(sinonimo: Sinonimo) { | |
| 34 | + setSinonimo(sinonimo: Producto) { | |
| 30 | 35 | |
| 31 | 36 | this.sinonimo = sinonimo; |
| 32 | 37 | } |