1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular 9 router events on lazy loaded module

Discussão em 'Angular' iniciado por Véoth, Novembro 27, 2025.

  1. Véoth

    Véoth Guest

    I am struggling with the Router.events observable given by Angular. My application has two lazy loaded module. Each have a navmenu that display some links to navigate inside the application. I want one of my link to appear as selected depending on the current route.

    The thing is that when I use the async pipe of an observable based on the router.events obserable, the routing events have already been emitted before my template is handled by 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 !

    Continue reading...

Compartilhe esta Página