Hello,
I have a ion-nav in a separate section of my app (independant of the Angular routing that I’m using for the main content of my app). And I would like to INSERT a stack of pages into this ion-nav at a specified index, the functions insertPages and setPages seems perfect but lacks documentation.
To push a view one by one it’s :
@ViewChild("nav") nav: IonNav;
ngOnInit(): void {
await this.nav.push(MyNewComponent, { input1: "value", input2: "value" });
}
And I would like to do something like :
@ViewChild("nav") nav: IonNav;
ngOnInit(): void {
// Index 1
await this.nav.insertPages(1, [
{ component: MyNewComponent, componentProps: { input1: "value", input2: "value" } },
{ component: MyNewComponent, componentProps: { input1: "value2", input2: "value2" } },
{ component: MyNewComponent, componentProps: { input1: "value2", input2: "value3" } }
]);
}
But this is currently not possible … It says incompatible with type NavComponent which is "Function | HTMLElement | ViewController"
. So I can do the following to have 0 errors but HOW to pass componentProps
as well ??
@ViewChild("nav") nav: IonNav;
ngOnInit(): void {
// Index 1
await this.nav.insertPages(1, [ MyNewComponent, MyNewComponent, MyNewComponent ]);
}
I would appreciate any help …
doc : https://ionicframework.com/docs/api/nav
cross-reference: https://github.com/ionic-team/ionic-framework/issues/21724