import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
-import { FormControl, Validators } from '@angular/forms';
+import { UntypedFormControl, Validators } from '@angular/forms';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Observable } from 'rxjs';
bodyTemplate: TemplateRef<any>;
bodyContext: object;
submitActionObservable: () => Observable<any>;
+ callBackAtionObservable: () => Observable<any>;
submitAction: Function;
+ backAction: Function;
deletionForm: CdFormGroup;
itemDescription: 'entry';
itemNames: string[];
ngOnInit() {
const controls = {
- confirmation: new FormControl(false, [Validators.requiredTrue])
+ confirmation: new UntypedFormControl(false, [Validators.requiredTrue])
};
if (this.childFormGroup) {
controls['child'] = this.childFormGroup;
}
}
+ callBackAction() {
+ if (this.callBackAtionObservable) {
+ this.callBackAtionObservable().subscribe({
+ error: this.stopLoadingSpinner.bind(this),
+ complete: this.hideModal.bind(this)
+ });
+ } else {
+ this.backAction();
+ }
+ }
+
hideModal() {
this.activeModal.close();
}