小编Véo*_*oth的帖子

延迟加载模块上的 Angular 9 路由器事件

我正在努力处理 Angular 提供的 Router.events observable。我的应用程序有两个延迟加载的模块。每个都有一个导航菜单,显示一些在应用程序内部导航的链接。我希望我的链接之一根据当前路线显示为选定状态。

问题是,当我使用基于 router.events 可观察的可观察的异步管道时,在我的模板被 Angular 处理之前,路由事件已经被发出。

I Kknow that if I subscribe manually inside the constructor of my component, I can get the data. If I do the same inside the ngOnInit function, same as with the async pipe, there are no data emitted. It's working fine if I navigate using a link after the page is loaded.

Do you know a way on how I could achieve that ?

Thanks !

lazy-loading angular

5
推荐指数
1
解决办法
1846
查看次数

标签 统计

angular ×1

lazy-loading ×1