March 2018
Intermediate to advanced
380 pages
9h 23m
English
We need a route declaration so that we can access the entity pages. This is declared in product.route.ts.
For example, this declares the detail view of the entity:
{ path: 'product/:id', component: ProductDetailComponent, data: { authorities: ['ROLE_USER'], pageTitle: 'storeApp.product.home.title' }, canActivate: [UserRouteAccessService] }
The data attribute is used to pass metadata such as allowed roles and page titles to the component. The UserRouteAccessService defined in the canActivate attribute decides whether a user has the authorization to view the page and uses the authorities metadata and authentication details to verify. Routes having a popup, declares the outlet: 'popup' attribute.