Javascript 如何通过routes打开ionic 4 modal?

Javascript 如何通过routes打开ionic 4 modal?,javascript,angular,ionic4,Javascript,Angular,Ionic4,我需要开几条路 我试过这样做,但没有成功 ngOnInit() { this.presentModal(); } async presentModal() { const modal = await this.modalController.create({ component: AuthPasswordRecoveryPage, componentProps: { } }); return await modal.present

我需要开几条路

我试过这样做,但没有成功

ngOnInit() {
    this.presentModal();
  }

  async presentModal() {
    const modal = await this.modalController.create({
      component: AuthPasswordRecoveryPage,
      componentProps: { }
    });
    return await modal.present();
  }

在函数中尝试此承诺链,而不是异步等待:

presentModal() {    
this.modalController
 .create({
   component: AuthPasswordRecoveryPage,
   componentProps: { }
 })
 .then(modalEl => {
   modalEl.present();
 })
}

在函数中尝试此承诺链,而不是异步等待:

presentModal() {    
this.modalController
 .create({
   component: AuthPasswordRecoveryPage,
   componentProps: { }
 })
 .then(modalEl => {
   modalEl.present();
 })
}

它工作得很好。您是否使用ngOnInit实现您的组件??或控制台中的任何错误??其工作正常。您是否使用ngOnInit实现您的组件??或控制台中的任何错误??