我们如何创建类似堆栈的结构来导航页面,以便我们可以从同一页面创建页面的新对象,这里我想从 SuperPage 转到 SuperPage 但角度路由不支持它,在 IONIC3 中我们可以很容易地实现它navCtrl 的 push 方法,但我想在 ionic 4 中的同一页面(SuperPage)上导航,那么我们该如何实现呢?
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NavController } from '@ionic/angular';
@Component({
selector: 'app-super',
templateUrl: './super.page.html',
styleUrls: ['./super.page.scss'],
})
export class SuperPage implements OnInit {
constructor(private router: Router, private navCtrl: NavController) { }
nextPage() {
//working in ionic3
//this.navCtrl.push('SuperPage');
//ionic4
//1.not working
//this.navCtrl.navigateForward('super');
//2.not working
//this.navCtrl.navigateRoot('super');
//3.not working
// this.router.navigate(['super']);
this.router.navigateByUrl('super');
}
}