延迟加载的模块路由在命名路由器出口中不起作用

时间:2020-05-25 02:44:03

标签: angular

我尝试寻找答案,但我找不到任何答案。因此在这里发布。即使在角度8(我当前正在使用)中仍无法解决,也不确定。

在routerLink中使用来自特定模块的路由以将其呈现在命名路由器出口中时,该路由不起作用。

在下面的示例中:路由到“ comp2”正常,但是尝试使用“ mcomp2”时错误输出。尝试了所有可能的组合,包括完整的路由路径等,但问题仍然存在。

我有一些解决方法,可以消除路由器插座的出路,而可以使用其他方法,但是想在进行操作之前进行检查。

AppRouting:

q.drain

Module1路由:

    override fun onInitializationSuccess(provider: YouTubePlayer.Provider?, player: YouTubePlayer?, wasRestored: Boolean) {
    if(player == null) return

    if(wasRestored) {
        player.cueVideo("someid")
        player.play()
    } else {
        youtubePlayer = player

    }
}
    private fun initializeLayout() {
     youtubeplayer_fragment.visibility = View.VISIBLE
     val auctionStream = childFragmentManager.findFragmentById(R.id.youtubeplayer_fragment) as YouTubePlayerSupportFragment
     auctionStream.initialize(Constants.YOUTUBE_API_KEY, this)
}

AppComponent:

const routes: Routes = [
  {
    path: '', redirectTo: 'comp1', pathMatch: 'full'
  },
  {
    path: 'comp1', component: Component1Component
  },
  { path: 'comp2', outlet: 'routeO1', component: Component2Component }, --> This works
  {
    path: 'module', loadChildren: './modules/module1/module1.module#Module1Module'
  }
];

0 个答案:

没有答案