[英]Lazy load component into Angular auxiliary outlet
I have the following routes configuration:我有以下路由配置:
const routes: Routes = [
{
path: '',
pathMatch: 'full',
redirectTo: 'container-page'
},
{
path: 'container-page',
component: ContainerPage,
children: [
{
path: 'first-page',
loadChildren: '../first-page/first-page.module#FirstPageModule',
outlet: 'detail'
},
]
},
];
As you can see, I'm trying to lazy load a component into an auxiliary outlet, but upon navigating to the appropriate route ( http://localhost:4200/container-page/(detail:first-page) , inside the outlet in question an ng-component is rendered, and inside it, a new empty router-outlet and another ng-component at the same DOM level. What this does is that the newly rendered router-outlet completely hides the ng-component at its level and the content won't show.如您所见,我正在尝试将组件延迟加载到辅助插座中,但是在导航到插座内的适当路线( http://localhost:4200/container-page/(detail:first-page) )时有问题的是,一个 ng-component 被渲染,在它里面,一个新的空路由器出口和另一个 ng-component 在同一 DOM 级别。这样做是新渲染的路由器出口在其级别完全隐藏了 ng-component并且内容不会显示。
This behavior is NOT registered when in primary outlets, only in auxiliary named outlets.此行为在主要出口中不会注册,仅在辅助命名的出口中注册。 Has anyone succeeded in lazy loading a component into an auxiliary outlet?有没有人成功地将组件延迟加载到辅助插座中?
You cannot lazy load components, I am having trouble with this myself.您不能延迟加载组件,我自己也遇到了问题。 Do you have sub routing set up for that lazy loaded module?您是否为该延迟加载的模块设置了子路由?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.