根段不能具有矩阵参数Ionic 4

时间:2019-06-26 17:50:11

标签: angular typescript ionic-framework ionic4

有什么线索可以解决这个问题吗?

.ts

this.navCtrl.navigateRoot(["", { hotelId: data.h }])

路线

           {
                path: "",
                component: HomePage,
            },
  

未处理的承诺拒绝:根段不能具有矩阵   参数;区域:任务:Promise.then;值:错误:根   段不能具有矩阵参数

1 个答案:

答案 0 :(得分:0)

这对我有用。即NavigationExtras

.ts

import { NavigationExtras } from "@angular/router";

 const navigationExtras: NavigationExtras = {
          queryParams: { "hotelId": data.h },
        };    

this.navCtrl.navigateRoot([""], navigationExtras); 

参考: Route Doc