0

The structure of the application is having a single view (DynamicViewComponent) that will hold different contentBlocks on different routes.

So the problem I'm having trouble with is that when navigating from one route to another, previous instance of the DynamicViewComponent is not destroyed. The application start to build up nodes and listeners with every navigation action. The methods inside the DynamicViewComponent are firing as many as navigation clicks were done.

I've tried to clear the ViewContainerRef, but that only results in clearing stuff from the DOM, not the actual cached instances from previous routes.

Novica
  • 1

1 Answers1

0

You need to utilize the angular router, inside your DynamicViewComponent you should have a <router-outlet> where the different content blocks will be placed and in the routes declare the DynamicViewComponent as the main path path: '' enter image description here