[SOLVED] Child route not found

I’m trying to create a child route with an :id parameter.
I get: [app-router] Error: Route not found: {id-goes-here}.
The generated url I get is: #/meetings/meeting/{guid-goes-here}, so it looks correct, #/meetings being the main route.

This is my child router config (I inject the router in the constructor):

public configureRouter(routerConfig: RouterConfiguration): void {
    routerConfig.title = '';

    routerConfig.map([
        {
            route: 'meeting/:id?',
            name: 'meeting',
            moduleId: '../Views/meeting',
            title: 'Möte',
            settings: {
                view: './meeting.html'
            }
        }
    ]);
}

Then I try to access it like this (I’m using generate() to be able to debug the url):

public selectMeeting(id?: any): void {
    let url: string = this.router.generate('meeting', {id});

    this.router.navigate(url);
}

But then I get: [app-router] Error: Route not found: {id-goes-here}.
Shouldn’t the error message be: [app-router] Error: Route not found: meeting/{id-goes-here}?
And why is it not found?

Am I missing some basic stuff here? I’ve basically copied the example of the skeleton navigation for typescript, with the exception for the :id parameter. Is there more magic to child routes that I think there is?

GOT IT!

The main route was
route: ‘meetings/:id’

which made the first part of the child route become the :id part of the main route.

This app is shaping up well now.

1 Like