Skip to content

ion-modal don't work in sample sidemenu #19645

Description

@juanqui66

Bug Report

Ionic version:
ionic version
5.2.1

Current behavior:
When creating a modal screen and invoking it from a button enabled on the HomePage, when I press on the Home menu, instead of loading the HomePage, the PopupPage is loaded directly.

Expected behavior:
The HomePage page should load and display instead of PopupPage.

Steps to reproduce:

  1. ionic start myApp sidemenu
  2. ionic g page popup
  3. After the HomePape page card, we add
    <ion-button color = "primary" (click) = "loadPopup ()"> Load popup
    in home.page.html
    In home.pase.ts:
    public loadPopup() {
    this.presentModal();
    }

async presentModal() {
const modal = await this.modalController.create({
component: PopupPage
});
return await modal.present();
}
4. In home.module.ts we import PopupPageModule, as indicated in the documentation of ion-modal / ion-modal-controller (lazy loading):
import {PopupPageModule} from '../popup/popup.module';
and add PopupPageModule to imports array.

Now, clicking on the Home menu option, the PopupPage page is loaded, instead of HomePage.

Related code:

It is reproduced with the sample application that Ionic creates with sidemenu.

Other information:

Ionic info:
\myApp>ionic info

Ionic:
Ionic CLI : 5.2.1 (C:\Users\juanc\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.0
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0

Utility:
cordova-res : 0.6.0
native-run : 0.2.4

System:
NodeJS : v10.11.0 (C:\Program Files\nodejs\node.exe)
npm : 6.11.2
OS : Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions