Umwelt: RC4 mit neuen RouterIn Angular2 Routing, mit neuen Router, wie umleiten ich nur leere Pfad?
Ich habe folgende Fräser Config ..
export const routes: RouterConfig = [
{path: 'search-documents', component: SearchDocumentsComponent},
{
path: '',
pathMatch: 'prefix',
redirectTo: '/search-documents'
},
{path: '**', component: NotFoundComponent}
];
Es funktioniert wie folgt ...
http://SERVER ----------- ------->http://SERVER/search-documents
http://SERVER/ ----------------->http://SERVER/search-documents
http://SERVER/does-not-exist --->http://SERVER/search-documents
aber ich will ...
http://SERVER ------------------>http://SERVER/search-documents
http://SERVER/ --- -------------->http://SERVER/search-documents
http://SERVER/does-not-exist ---> NotFoundComponent
Wie ich das erreiche bitte?
Zusätzliche Information:
Wenn ich entfernen ..
{
path: '',
pathMatch: 'prefix',
redirectTo: '/search-documents'
}
ich ..
http://SERVER ------------------ > NotFoundComponent
http://SERVER/ -----------------> NotFoundComponent
http://SERVER/does-not-exist ---> NotFoundComponent
Warum verwenden Sie 'prefix' für' pathMatch' anstelle von 'full'? –
Diese Änderung hat es behoben! Danke vielmals – danday74