import { Injectable } from '@angular/core';
      import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
      import { Observable } from 'rxjs';
      @Injectable({ providedIn: 'root' })
      export class YourResolver implements Resolve<ObjectToResolve> {
        resolve(route: ActivatedRouteSnapshot): Observable<ObjectToResolve> | Promise<ObjectToResolve> | ObjectToResolve {
          return ;

      Typescript language logoAngular Resolver

      Angular TypeScript Recipes

      The code above defines a class called YourResolver which implements the Resolve<ObjectToResolve> interface. In order to use this class, you need to inject it into a class that wants to use it. The providedIn property on the YourResolver class indicates that it can be injected into the root class.

      The resolve method takes a route object as its only argument. The route object represents the path of the page or route that the resolving object should be applied to. The resolve method will return three possible values: an Observable, a Promise, or an ObjectToResolve. The first two values will contain the result of resolving the route. The third value will be the resolved object.

      Shortcut: angular.resolver


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.