Often you need to switch multiple pages, thus requiring routing
1. Define a document dedicated to each path configuration component after a jump, a component represents a page
import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { SimpleTestComponent } from './simple-test/simple-test.component'; import { MyTestComponent } from './my-test/my-test.component'; const routes: Routes = [ { path: '', redirectTo: '/simple', pathMatch: 'full' }, { path: 'simple', component: SimpleTestComponent }, { path: 'test/:myParam', component: MyTestComponent }, ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { }
2. app module which references it
3. Place a routing root page elements and some of the jump test link
4. Now you can switch the page
Note: The page can get a jump pass over the parameters:
Parameter name defined note: