• Overview
@angular/router

createUrlTreeFromSnapshot

function

Creates a UrlTree relative to an ActivatedRouteSnapshot.

  
    function createUrlTreeFromSnapshot(  relativeTo: ActivatedRouteSnapshot,  commands: any[],  queryParams?: Params | null,  fragment?: string | null): UrlTree;
  
  

createUrlTreeFromSnapshot

Creates a UrlTree relative to an ActivatedRouteSnapshot.

@paramrelativeToActivatedRouteSnapshot

The ActivatedRouteSnapshot to apply the commands to

@paramcommandsany[]

An array of URL fragments with which to construct the new URL tree. If the path is static, can be the literal URL string. For a dynamic path, pass an array of path segments, followed by the parameters for each segment. The fragments are applied to the one provided in the relativeTo parameter.

@paramqueryParamsParams | null

The query parameters for the UrlTree. null if the UrlTree does not have any query parameters.

@paramfragmentstring | null

The fragment for the UrlTree. null if the UrlTree does not have a fragment.

@returnsUrlTree
Jump to details