Bonjour,
J'ai configuré 3 modules dans mon application, cependant j'en ai qu'un seul dont les routes fonctionnent correctement et c'est le fichier "gestion-compte.module" :
j'ai également réalisé un autre module "gestion-ludis.module" qui cette fois, a ses routes qui ne fonctionnent pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule, Routes } from '@angular/router'; import { GestionCompteService } from './gestion-compte.service'; import { ConnexionComponent } from './connexion/connexion.component'; import { InscriptionComponent } from './inscription/inscription.component'; import { ProfilComponent } from './profil/profil.component'; import { FormsModule } from '@angular/forms'; const routesCompte:Routes=[ {path:'connexion',component:ConnexionComponent}, {path:'inscription',component:InscriptionComponent}, {path:'mon-profil',component:ProfilComponent} ] @NgModule({ declarations: [ ConnexionComponent, InscriptionComponent, ProfilComponent ], imports: [ CommonModule, FormsModule, RouterModule.forChild(routesCompte) ], providers:[GestionCompteService] }) export class GestionCompteModule { }
En clair , lorsque je remplace le parametre "identite" par "john" par exemple, cela me renvoi une page blanche avec pour erreur dans la console :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule, Routes } from '@angular/router'; import { GestionLudisService } from './gestion-ludis.service'; import { ListeLudisComponent } from './liste-ludis/liste-ludis.component'; import { LudiComponent } from './ludi/ludi.component'; const routesLudis:Routes=[ {path:'maison-de-:identite',component:ListeLudisComponent,children:[ {path:':nomLudi',component:LudiComponent} ]}, ] @NgModule({ declarations: [ ListeLudisComponent, LudiComponent ], imports: [ CommonModule, RouterModule.forChild(routesLudis) ], providers:[GestionLudisService] }) export class GestionLudisModule { }
"main.ts:6 ERROR Error: Uncaught (in promise): Error: NG04002: Cannot match any routes. URL Segment: 'maison-de-john'
Error: NG04002: Cannot match any routes. URL Segment: 'maison-de-john' "
voici pour finir mon app module :
Merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { GestionCompteModule } from './gestion-compte/gestion-compte.module'; import { GestionLudisModule } from './gestion-ludis/gestion-ludis.module'; import { CombatModule } from './combat/combat.module'; import { AccueilComponent } from './accueil/accueil.component'; import { HttpClientModule } from '@angular/common/http'; @NgModule({ declarations: [ AppComponent, AccueilComponent ], imports: [ BrowserModule, HttpClientModule, GestionCompteModule, GestionLudisModule, CombatModule, AppRoutingModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
Partager