Platform.blink路由,子路由不再起作用

问题描述

我有一个9型的应用程序,并且正在使用Material。我有两个不同的模板:用于移动和用于dekstop。

因此,通过路由,它知道必须加载巫婆模板:移动模板或桌面模板。

所以看起来像这样:

app.component.ts

 constructor(
    public oidcSecurityService: OidcSecurityService,private router: Router,public platform: Platform,private route: ActivatedRoute
  ) {
    if (platform.BLINK === true && platform.ANDROID === true) {
      this.router.navigate(['mobile'],{ relativeto: this.route });
    } else if (platform.BLINK === true && platform.ANDROID === false) {
      this.router.navigate(['desktop'],{ relativeto: this.route });
    }
  }

但是问题是我现在有一个像这样的路由器:

const routes: Routes = [
   {
    path: 'hello',/* pathMatch: 'full',*/
    component: DesktopDashboardComponent,},{
    path: 'test-desktop',component: TestDesktopComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],exports: [RouterModule]
})
export class DesktopRoutingModule {}

和我的app-routing.module.ts看起来像这样:

const routes: Routes = [
   {
    path: 'mobile',loadChildren: () =>
      import('../app/mobile-dashboard/mobile-dashboard.module').then(m => m.MobileDashboardModule)
  },{
    path: 'desktop',loadChildren: () =>
      import('./desktop-dashboard/desktop-dashboard.module').then(m => m.DesktopDashboardModule),{
    path: 'autologin',component: AutoLoginComponent
  }
];

但是,如果我想手动导航到以下URL:http:// localhost:4200 / desktop / test-desktop,它将无法正常工作。它返回到:http:// localhost:4200 / desktop

但是,如果我将其注释掉:

if (platform.BLINK === true && platform.ANDROID === true) {
      this.router.navigate(['mobile'],{ relativeto: this.route });
    }

我可以转到网址:

http://localhost:4200/desktop/test-desktop

但是,当然,移动模板不再起作用了。如果我将其注释掉。

那该怎么办?

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)