Routing daughters routes4

0

Hello, I'm encountering problems with my child routes.

Follow my routing:

export const ROUTES: Routes = [
    { path: '', redirectTo: 'Login', pathMatch: 'full' },
    { path: 'Login', component: Login },
    { path: 'Cadastro', component: CadastroUser, children: 
        [
            { path: '', redirectTo: 'dados-pessoais', pathMatch: 'full' },
            { path: 'dados-pessoais', component: DadosPessoais},
            { path: 'bancos', component: CadastroBancos}
        ] 
    }
]

I'm having problems on the child routes of the path: 'Register'.

The problem is that I'm on the route: 'cadastro / personal data', and I created a button like this:

<button class="btn" [routerLink]="['bancos']">Proximo Passo</button>

To go to the route: 'register / banks'.

But this error is displayed:

My outlet call looks like this:

<router-outlet></router-outlet>

Could anyone help me?

    
asked by anonymous 04.07.2018 / 15:01

1 answer

1

Guilherme, your route is for /cadastro/bancos and not for /cadastro/dados-pessoais/bancos as it is being sent. Changes your button to redirect to

['/cadastro/bancos']

Or create a new children in your personal data:

 { path: 'dados-pessoais', component: DadosPessoais , children:
    [
       { path: 'bancos', component: CadastroBancos}
    ]
}
    
04.07.2018 / 15:10