diff --git a/src/app/components/popover-sinonimos/popover-sinonimos.component.ts b/src/app/components/popover-sinonimos/popover-sinonimos.component.ts index 370f0e6..4f4b09a 100644 --- a/src/app/components/popover-sinonimos/popover-sinonimos.component.ts +++ b/src/app/components/popover-sinonimos/popover-sinonimos.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core'; import { PopoverDirective } from 'ngx-bootstrap'; -import { Sinonimo } from 'src/app/wrappers/sinonimo'; +import { Producto } from 'src/app/wrappers/producto'; @Component({ selector: 'app-popover-sinonimos', @@ -11,13 +11,18 @@ export class PopoverSinonimosComponent implements OnInit { //Directiva del popover, para poder cerrarlo desde este componente @Input() popover: PopoverDirective; - @Input() popoverContent: Sinonimo[]; - @Output() sinonimoSeleccionado = new EventEmitter(); - sinonimo: Sinonimo; + @Input() popoverContent: Producto[]; + @Output() sinonimoSeleccionado = new EventEmitter(); + sinonimo: Producto; constructor() { } ngOnInit() { + + //Seteo en la variable a emitir el sinonimo que sea padre + this.popoverContent.forEach(sinonimo => { + this.sinonimo = sinonimo.esPadre ? sinonimo : undefined; + }) } hidePopover() { @@ -26,7 +31,7 @@ export class PopoverSinonimosComponent implements OnInit { this.popover.hide(); } - setSinonimo(sinonimo: Sinonimo) { + setSinonimo(sinonimo: Producto) { this.sinonimo = sinonimo; }