0

I Implemented router reuse strategy by following this THREAD

Here all routes and components instance have been saved on every single visit. This cause some misbehaviour in our functionality. So I decided to store particular instance at particular point based on some condition like using shared service value or based on property of a component. RouteReuseStrategy not allowing to create any constructor.How can I achieve this ?

k11k2
  • 2,036
  • 2
  • 22
  • 36

1 Answers1

0

Don't know how effective it is but I tried to extract properties from component instance

store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle) {
   const componentRef: ComponentRef<any> = handle ? handle['componentRef'] : null ;
   //IF condition
     this.handlers[this.getRouteUrl(route)] = handle;
}
k11k2
  • 2,036
  • 2
  • 22
  • 36