Ivan Bacher
Ivan Bacher

Reputation: 6154

using router.navigateToRoute() to navigate to child route

I have the following app structure:

-app
    -route1
    -route2
        -child1
        -child2

I would like to navigate to route2/child1 from route1. Using this.router.navigateToRoute(name of child route) results in an error: A route with name 'ranking' could not be found.

Any suggestions?

Upvotes: 2

Views: 126

Answers (1)

bigopon
bigopon

Reputation: 1964

This is a known no-workaround issue, due to the nature of lazy loading. As you cannot know what route will be available in route2 until you have loaded it successfully. Typically we can use .navigate with parameter for this.

Upvotes: 2

Related Questions