ionic angular 8 get component instance

Discussão em 'Angular' iniciado por Semen Shekhovtsov, Dezembro 17, 2024.

  1. I've tried different ways to get the component instance after creating a modal using ionic and angular, however nothing worked for me. Could you please help me to understand, how can I get a component instance reference after creting a modal? The sample code is listed below:

    const modal = await this.modalController.create({
    component: MyCustomComponent,
    cssClass: "some-css-class",
    componentProps:
    {
    item: item
    },
    backdropDismiss: false
    });

    modal.canDismiss = async (data?: any, roleDismiss?: string) => {
    let can = false;
    return new Promise<boolean>(resolve => resolve(can));
    }


    for example, in the canDismiss handler I'd like to verify some actual component instance properties, however I can't seem to find a proper way of doing this. How can I access the MyCustomCompnent instance after creating the modal?

    I'm using ionic angular 8, angular 18.1.3

    Continue reading...

Compartilhe esta Página