ActivatedRouteSnapshot
This is the documentation for Angular 6.
You can switch to the latest version Angular 10.
You can switch to the latest version Angular 10.
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;
}
}
Links & Tutorials
Properties
routeConfig
#
routeConfig: Route | null
url
#
url: UrlSegment[]
params
#
params: Params
queryParams
#
queryParams: Params
fragment
#
fragment: string
data
#
data: Data
outlet
#
outlet: string
component
#
component: Type<any> | string | null
root
#
root: ActivatedRouteSnapshot
parent
#
parent: ActivatedRouteSnapshot | null
firstChild
#
firstChild: ActivatedRouteSnapshot | null
children
#
children: ActivatedRouteSnapshot[]
pathFromRoot
#
pathFromRoot: ActivatedRouteSnapshot[]
paramMap
#
paramMap: ParamMap
queryParamMap
#
queryParamMap: ParamMap