1

Is there anyway to limit the amount of saved handlers when using angulars RouteReuseStrategy?

I don't know if it will be a problem but my app is kinda heavy already and using RouteReuse would help alot with navigating to and from components for our client duo to the complexity of the information/alot of forms.

I currently save the handlers in:

handlers: { [key: string]: DetachedRouteHandle } = {};

But I'd like to limit the handlers to 10 or something, and when the "counter" hits 11, detach the last one.

I was thinking about saving the handlers in a simple object along with the abover handler (queHandler = [] add it with this.queHandler.push(key)), and then check the length, but how do I Detach them properly after counter hit max? Or do I simply get the handle and call destroy on the component?

Edit: The original guide I followed was Corbfon's answer in How to implement RouteReuseStrategy shouldDetach for specific routes in Angular 2

shaosson
  • 56
  • 5

0 Answers0