Angular Routing

From bibbleWiki
Revision as of 13:21, 7 September 2020 by Iwiseman (talk | contribs) (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=...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Setting up Routing requires three steps

  • Configuring the routes
  • Activating the routes
  • Identifying where to place the route templates

Configuring the routes

    RouterModule.forChild([
      { path: 'products', component: ProductListComponent },
      { path: 'products/:id', component: ProductDetailComponent },
      {
        path: 'products/:id/edit',
        canDeactivate: [ProductEditGuard],
        component: ProductEditComponent
      }
    ])

Activating the routes

Identifying where to place the route templates