How to define optional segment parameter in Ionic

2019-06-24 15:17发布

How it is possible to define a optional parameter in Ionic 3 PWA?

My current @IonicPage decorator looks like:

@IonicPage({
    segment: "landing/:id"
})

But the id param must be optional. If I do not pass the id, I receive this error:

Uncaught (in promise): invalid views to insert

How to do it?
Thanks in advance!

1条回答
smile是对你的礼貌
2楼-- · 2019-06-24 16:08

There is no method yet.You need to send empty string when you don’t need it.That is the workaround for this now.

 this.navCtrl.push('landing', {
      'id': ''
    })
查看更多
登录 后发表回答