|
@@ -14,13 +14,18 @@ export class ModalService {
|
|
|
private _resultSubject = new Subject<any>();
|
|
|
result$ = this._resultSubject.asObservable();
|
|
|
|
|
|
+ private _isModalOpen = false;
|
|
|
+ public get isModalOpen(): boolean {
|
|
|
+ return this._isModalOpen;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Opens the modal with the specified component and provides the data as input for the component.
|
|
|
* @param component The component to open in the modal.
|
|
|
* @param data The data for the input of the component.
|
|
|
*/
|
|
|
public openModal(component: any, data: any) {
|
|
|
- console.log('ModalService: openModal');
|
|
|
+ this._isModalOpen = true;
|
|
|
this._modalSubject.next({ component, data });
|
|
|
}
|
|
|
|
|
@@ -30,8 +35,9 @@ export class ModalService {
|
|
|
* @param data The oprional data object that eg contains a new or modifed weapon object.
|
|
|
*/
|
|
|
public handleModalClosing(result: any, data?: any) {
|
|
|
- //The host components subscribe to the result$ Observable to get the result of the modal
|
|
|
+ //The host components subscribes to the result$ Observable to get the result of the modal
|
|
|
this._resultSubject.next({ state: result, data: data });
|
|
|
this._closeModalSubject.next('close');
|
|
|
+ this._isModalOpen = false;
|
|
|
}
|
|
|
}
|