October 2017
Intermediate to advanced
280 pages
6h 50m
English
As the next step, let's update the declarations of the routes. Open ch7/step-0/app.ts and update the invocation of the forRoot method of RouteModule:
// ch7/step-1/app.ts
const routingModule = RouterModule.forRoot([
{
path: '',
redirectTo: 'home',
pathMatch: 'full'
},
{
path: 'home',
component: Home
},
{
path: 'dev-add',
component: AddDeveloper
},
{
path: 'add-dev',
redirectTo: 'dev-add'
}
]);
As the preceding snippet shows, the forRoot method accepts an array of route declarations as an argument. We define two redirects and two routes with components associated with them.
Each nonlazy-loaded route must define the following properties:
Read now
Unlock full access