Покажите онлайн демо .
В app.module.ts
import { TestComponent } from './test/test.component';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
const routes: Routes = [
{
path: 'test/:id/:token',
component: TestComponent
},
{
path: 'home',
component: HomeComponent
},
{
path: '**',
pathMatch: 'full',
redirectTo: '/home'
}
];
@NgModule({
declarations: [
AppComponent,
TestComponent,
HomeComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
RouterModule.forRoot(routes, {
useHash: true
})
],
entryComponents: [],
bootstrap: [AppComponent]
})
export class AppModule {}
В app.component.html
<router-outlet></router-outlet>