Issue
There is routes definition :
{ path:'some_path', component: some_component, canActivate: some_service}
How to pass data to the some_service ?
Solution
you can pass it this way:
first in your route definition add data property:
{ path:'some_path', component: some_component, canActivate: some_service, data: {routeData: <what ever you want to pass>}}
then in your some service guard you can access the data:
canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<boolean> {
let routeData = route.data.routeData;
}
Answered By - gil
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.