import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { BsModalRef } from 'ngx-bootstrap/modal'; import { Observable } from 'rxjs'; @Component({ selector: 'esp-form-modal', templateUrl: './form.modal.html', styleUrls: ['./form.modal.scss'], }) export class FormModalComponent implements OnInit { @Input() title: string; @Input() submitBtnTitle: string; @Input() cancelBtnTitle: string; @Output() submitEvent = new EventEmitter(); @Input() disabledLoad$: Observable; loadBtnDisabled: boolean; constructor(public bsModalRef: BsModalRef) {} ngOnInit() { this.disabledLoad$.subscribe(bool => { this.loadBtnDisabled = bool; }); } onClose() { this.bsModalRef.content.onClose.next(true); this.bsModalRef.hide(); } onSubmit(event) { this.bsModalRef.content.onSubmit.next(true); this.submitEvent.emit(event); } }