ActivatedRouteSnapshot
ActivatedRouteSnapshot
You can switch to the latest version Angular 8.
Contains the information about a route associated with a component loaded in an outlet at a particular moment in time. ActivatedRouteSnapshot
can also be used to traverse the router state tree.
Example
@Component({templateUrl:'./my-component.html'})
class MyComponent {
constructor(route: ActivatedRoute) {
const id: string = route.snapshot.params.id;
const url: string = route.snapshot.url.join('');
const user = route.snapshot.data.user;
}
}
Properties
children
#
The children of this route in the router state tree.
get children(): ActivatedRouteSnapshot[]
component
#
The component of the route.
component: Type<any> | string | null
data
#
The static and resolved data of this route.
data: Data
firstChild
#
The first child of this route in the router state tree.
get firstChild(): ActivatedRouteSnapshot|null
fragment
#
The URL fragment shared by all the routes.
fragment: string
outlet
#
The outlet name of the route.
outlet: string
paramMap
#
TODO
get paramMap(): ParamMap
params
#
The matrix parameters scoped to this route.
params: Params
parent
#
The parent of this route in the router state tree.
get parent(): ActivatedRouteSnapshot|null
pathFromRoot
#
The path from the root of the router state tree to this route.
get pathFromRoot(): ActivatedRouteSnapshot[]
queryParamMap
#
TODO
get queryParamMap(): ParamMap
queryParams
#
The query parameters shared by all the routes.
queryParams: Params
root
#
The root of the router state.
get root(): ActivatedRouteSnapshot
routeConfig
#
The configuration used to match this route.
routeConfig: Route|null
toString
#
toString(): string
url
#
The URL segments matched by this route.
url: UrlSegment[]