Angular Routing: Difference between revisions
Jump to navigation
Jump to search
Created page with "=Introduction= Setting up Routing requires three steps *Configuring the routes *Activating the routes *Identifying where to place the route templates ==Configuring the routes=..." |
|||
Line 5: | Line 5: | ||
*Identifying where to place the route templates | *Identifying where to place the route templates | ||
==Configuring the routes== | ==Configuring the routes== | ||
< | <syntaxhighlighting lang="ts"> | ||
RouterModule.forChild([ | RouterModule.forChild([ | ||
{ path: 'products', component: ProductListComponent }, | { path: 'products', component: ProductListComponent }, | ||
Line 15: | Line 15: | ||
} | } | ||
]) | ]) | ||
</ | </syntaxhighlighting> | ||
==Activating the routes== | ==Activating the routes== | ||
==Identifying where to place the route templates== | ==Identifying where to place the route templates== |
Revision as of 13:22, 7 September 2020
Introduction
Setting up Routing requires three steps
- Configuring the routes
- Activating the routes
- Identifying where to place the route templates
Configuring the routes
<syntaxhighlighting lang="ts">
RouterModule.forChild([ { path: 'products', component: ProductListComponent }, { path: 'products/:id', component: ProductDetailComponent }, { path: 'products/:id/edit', canDeactivate: [ProductEditGuard], component: ProductEditComponent } ])
</syntaxhighlighting>