1 pièce(s) jointe(s)
[Angular 4] Utilisation des routes
Bonjour
j'ai une structure :
Pièce jointe 324085
Ce que je recherche a faire c'est un menu simple composé comme ceci :
Accueil | Inscription | Contact | Login
pour Accueil, Contact, Login j'arrive mais pour Inscription j'ai un problème car en fait quand je saisie le lien il va pas sur inscription mais logement !
En clair quand je vais dans : SITE/logement/inscription je tombe comme si j'allais sur SITE/logement
Je ne comprend pas mon erreur !
Dans app-routing.module.ts j'ai :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| const routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{
path: 'home',
loadChildren: './home/home.module#HomeModule',
data: { preload: true }
},
{
path: 'logement',
loadChildren: './logement/logement.module#LogementModule',
data: { preload: true }
},
{
path: 'contact',
loadChildren: './contact/contact.module#ContactModule',
data: { preload: true }
},
{
path: 'login',
loadChildren: './login/login.module#LoginModule',
data: { preload: true }
},
{
path: 'register',
loadChildren: './login/login.module#LoginModule',
data: { preload: true }
},
//Si page non trouvée
{ path: '**', component: PageNotFoundComponent }
]; |
Dans logement-routing.module.ts :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| const logementRoutes: Routes = [
{
path: 'logement',
component: LogementComponent,
children: [
{
path: 'inscription',
loadChildren: './inscription/inscription.module#InscriptionModule',
data: { preload: true }
}
]
}
]; |
Et dans inscription-routing.module.ts j'ai :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| const inscriptionRoutes: Routes = [
{
path: 'inscription',
component: InscriptionComponent,
children: [
{
path: 'identification',
component: IdentificationComponent
},
{
path: 'etat-civil',
component: EtatCivilComponent,
canActivate: [WorkflowGuard]
},
{
path: 'address',
component: AdresseComponent,
canActivate: [WorkflowGuard]
},
// 4th Route
{
path: 'cursus',
component: CursusComponent,
canActivate: [WorkflowGuard]
},
// 5th Route
{
path: 'etudes',
component: EtudesComponent,
canActivate: [WorkflowGuard]
},
// 6th Route
{
path: 'residences',
component: ResidencesComponent,
canActivate: [WorkflowGuard]
}
]
}
]; |
Une petite aide ?
Merci