Commit 2b3acb1761330983e4540e8197e9124fdcbe40e2

Authored by Marcelo Puebla
1 parent 9be01bb197
Exists in master and in 1 other branch validar_pve

Agregado emitter para pasar el sinonimo seleccionado.

src/app/components/popover-sinonimos/popover-sinonimos.component.ts
1 import { Component, OnInit, Input } from '@angular/core'; 1 import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
2 import { PopoverDirective } from 'ngx-bootstrap'; 2 import { PopoverDirective } from 'ngx-bootstrap';
3 import { Sinonimo } from 'src/app/wrappers/sinonimo'; 3 import { Sinonimo } from 'src/app/wrappers/sinonimo';
4 4
5 @Component({ 5 @Component({
6 selector: 'app-popover-sinonimos', 6 selector: 'app-popover-sinonimos',
7 templateUrl: './popover-sinonimos.component.html', 7 templateUrl: './popover-sinonimos.component.html',
8 styleUrls: ['./popover-sinonimos.component.scss'] 8 styleUrls: ['./popover-sinonimos.component.scss']
9 }) 9 })
10 export class PopoverSinonimosComponent implements OnInit { 10 export class PopoverSinonimosComponent implements OnInit {
11 11
12 //Directiva del popover, para poder cerrarlo desde este componente 12 //Directiva del popover, para poder cerrarlo desde este componente
13 @Input() popover: PopoverDirective; 13 @Input() popover: PopoverDirective;
14 @Input() popoverContent: Sinonimo[]; 14 @Input() popoverContent: Sinonimo[];
15 sinonimoAelegir: Sinonimo; 15 @Output() sinonimoSeleccionado = new EventEmitter<Sinonimo>();
16 sinonimo: Sinonimo;
16 17
17 constructor() { } 18 constructor() { }
18 19
19 ngOnInit() { 20 ngOnInit() {
20 } 21 }
21 22
22 hidePopover() { 23 hidePopover() {
23 24
25 this.sinonimoSeleccionado.emit(this.sinonimo);
24 this.popover.hide(); 26 this.popover.hide();
25 } 27 }
26 28
27 setSinonimo(sinonimo: Sinonimo) { 29 setSinonimo(sinonimo: Sinonimo) {
28 30
29 this.sinonimoAelegir = sinonimo; 31 this.sinonimo = sinonimo;
30 } 32 }
31 33
32 } 34 }
33 35