I have a issue where the resolve data is showing as undefined in the component.
Below is my Resolve code
export class MyResolve implements Resolve<any> {
constructor(private dataServ: DataService) { }
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<any> {
return forkJoin([
this.dataServ.getA(),
this.dataServ.getB(),
this.dataServ.getC()
]).pipe(map(response => {
console.log(response)
return response;
})).toPromise().then(data => { console.log(data) });
}
}
I can see the data in the console. but when I use the data in component it shows undefined
below is the code in component
var test = this._route.snapshot.data;
console.log(test);
Where _route:ActivatedRoute
I have added the resolve in routing module also.
Please guide