May 2018
Intermediate to advanced
512 pages
11h 3m
English
A resolve guard is a type of a router guard, as mentioned in Chapter 9, Design Authentication and Authorization. A resolve guard can load necessary data for a component by reading record IDs from route parameters, asynchronously load the data and have it ready by the time the component activates and initializes.
The major advantages for a resolve guard includes reusability of loading logic, reduction of boilerplate code, and also shedding dependencies, because the component can receive the data it needs without having to import any service:
src/app/user/user/user.resolve.tsimport { Injectable } from '@angular/core'import { Resolve, ActivatedRouteSnapshot } from '@angular/router' ...Read now
Unlock full access