function
Maps an injectable class with a resolve function to an equivalent ResolveFn
for use in a Route
definition.
mapToResolve<T>(provider: Type<{ resolve: ResolveFn<T>; }>): ResolveFn<T>
provider | Type<{ resolve: ResolveFn<T>; }> |
ResolveFn<T>
Usage
@Injectable({providedIn: 'root'}) export class ResolveUser { resolve() { return {name: 'Bob'}; } } const userRoute: Route = { path: 'user', resolve: { user: mapToResolve(ResolveUser), }, };
© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/api/router/mapToResolve