How to open a Modal pop up after logged in before home page in cumulocity

How to open a Modal pop up after logged in before home page in cumulocity

Hi Asma,

can you share more details? Are you talking about one of the default applications (Cockpit, Device Management, Administration) or a custom application? In case of a custom application, is it built using the Angular Web SDK?

Best regards
Christian

Hi Christian,

I am building a custom application using Angular Web SDK. login screen is coming as default , I want to open a disclaimer modal pop up when user logged in successfully before reaching to home screen.

Thanks & Regards,
Asma

Hi Asma,

you could do something like this:

export class AppModule extends HybridAppModule {
  constructor(
    protected upgrade: NgUpgradeModule,
    private appState: AppStateService,
    private modalService: ModalService
  ) {
    super();
    this.appState.currentUser.pipe(filter((tmp) => !!tmp)).subscribe((user) => {
      this.modalService.confirm('Confirm', 'Are you sure you want to use this app?');
    });
  }
}

This will result in having a modal shown above the home page:

You can also show the modal directly on the login page before performing the login, by skipping the currentUser Subscription and directly calling the modal service.

Kind Regards,
Tristan

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.