import { Location } from '@angular/common';
-import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
-import { FormGroup, NgForm } from '@angular/forms';
+import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
+import { UntypedFormGroup, NgForm } from '@angular/forms';
import { ActionLabelsI18n } from '~/app/shared/constants/app.constants';
import { ModalService } from '~/app/shared/services/modal.service';
templateUrl: './form-button-panel.component.html',
styleUrls: ['./form-button-panel.component.scss']
})
-export class FormButtonPanelComponent {
+export class FormButtonPanelComponent implements OnInit {
@ViewChild(SubmitButtonComponent)
submitButton: SubmitButtonComponent;
backActionEvent = new EventEmitter();
@Input()
- form: FormGroup | NgForm;
+ form: UntypedFormGroup | NgForm;
@Input()
showSubmit = true;
@Input()
@Input()
btnClass = '';
@Input()
- submitText: string = this.actionLabels.CREATE;
+ submitText?: string;
@Input()
- cancelText: string = this.actionLabels.CANCEL;
+ cancelText?: string;
@Input()
disabled = false;
private modalService: ModalService
) {}
+ ngOnInit() {
+ this.submitText = this.submitText || this.actionLabels.CREATE;
+ this.cancelText = this.cancelText || this.actionLabels.CANCEL;
+ }
+
submitAction() {
this.submitActionEvent.emit();
}