Show global modal when receiving a push notification


#1

Hello. I’m using Nativescript 4.1 and Angular 5
I’m trying to display a modal using the ModalDialogService from nativescript-angular when receiving a push notification.
I tried showing the modal from app.component.ts with this options:

const options: ModalDialogOptions = {
      viewContainerRef: this.vcRef,
      context: {},
      fullscreen: true,
    };

The problem is that when I navigate to a different page and receive a push notification, I get this error:

Error: Parent page is not part of the window hierarchy. Close the current modal page before showing another one!

I think it’s because app.component is not part of the view anymore.