如何在 Ionic Page 中定义可选的段参数?

Leo*_*aes 5 typescript ionic-framework ionic2 ionic3 angular

如何在 Ionic 3 PWA 中定义可选参数?

我当前的@IonicPage装饰器看起来像:

@IonicPage({
    segment: "landing/:id"
})
Run Code Online (Sandbox Code Playgroud)

id参数必须是可选的。如果我没有通过id,我会收到此错误:

未捕获(承诺):要插入的无效视图

怎么做?
提前致谢!

Sam*_*ath 3

目前还没有方法。当您不需要\xe2\x80\x99 时,您需要发送空字符串。这就是现在的解决方法。

\n\n
 this.navCtrl.push('landing', {\n      'id': ''\n    })\n
Run Code Online (Sandbox Code Playgroud)\n