2017-02-21 6 views
1

Ich kämpfe mit Angular 2. Ich habe alle meine Routen definiert, aber wenn ich zum Beispiel "mysiteurl: 4200/password-recovery" oder "mysiteurl: 4200/email-confirm/sayoken" tippe es treibt mich wahllos nach hause/profile Component (nicht erwünscht) oder zur passwortwiederherstellung oder email-confirm Component (gewünscht). Ich verstehe diese Umleitung zum Home/Profil nicht. Irgendwelche Ideen?Angular 2: Zufälliges Routing

Die App-Routing-Modul-Code:

const appRoutes: Routes = [ 
{ path: 'login', component: LoginComponent }, 
{ path: '', redirectTo: 'home', pathMatch: 'full' }, 
{ path: 'password-recovery', component: PasswordRecoveryComponent }, 
{ path: 'email-confirm/:token', component: EmailConfirmComponent }, 
{ path: 'home', component: HomeComponent, 
    children: [ 
     { path: '', redirectTo: 'profile', pathMatch: 'full' }, 
     { path: 'profile', component: ProfileComponent }, 
     { path: 'companies', component: CompaniesComponent }, 
     { path: 'roles', component: RolesComponent }, 
     { path: 'documents/:type', component: DocumentsComponent }, 
     { path: 'users', component: UsersComponent }, 
     { path: 'documents-identity', component: DocumentsIdentityComponent }, 
     { path: 'forms', component: FormsComponent }, 
     { path: 'password-recovery-detail', component: PasswordRecoveryDetailComponent }, 
     { path: 'card', component: CardComponent }, 
    ] 
} 
]; 
@NgModule({ 
    imports: [ 
     RouterModule.forRoot(appRoutes, { useHash: true }) 
    ], 
    exports: [ 
     RouterModule 
    ] 
}) 
export class AppRoutingModule { } 
+0

Sie konfiguriert sind, um 'useHash' für Ihre Navigation. So verwenden Sie Hash-Ansatz: mysiteurl: 4200/#/password-recovery – mrkosima

+0

Es hat keinen Einfluss auf das Ergebnis .. Manchmal Passwort-Recovery, manchmal zu Hause/Profil –

Antwort

1

Meine Schuld, ich zwang die Navigation zu/home/Profil in der Bootstrap-Komponente