aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/customModal/components/modalButton/modal-button.component.ts
blob: d93c67851042352a71caf8ba2c4de93b4450234b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import {Component, EventEmitter, HostListener, Input, Output} from "@angular/core";
import {CustomButtonComponent} from "../../../customButton/custom-button.component";

@Component({
  selector: "custom-modal-button",
  templateUrl: './modal-button.component.html',
  styleUrls: ['./modal-button.component.scss']
})
export class CustomModalButtonComponent extends CustomButtonComponent {

  @Input() public id?: string;
  @Input() public callback: Function;
  @Input() public closeModal: boolean;
  @Output() closeModalEvent: EventEmitter<any> = new EventEmitter<any>();
  @HostListener('click') invokeCallback = (): void => {
    if (this.callback) {
      this.callback();
    }
    if (this.closeModal) {
      this.closeModalEvent.emit();
    }
  }

  constructor() {
    super();
    this.closeModal = false;
  }
}