I am very new to angular 2 and I am having problems with unloading modules and components. Below is my problem description:
- trying to built a large SPA containing like 600-700 pages/components.
- using webpack for the project
- structuring the project like:
- main module
- child module a
- page component a1
- page component a2
- ...
- page component aN
- child component a
- child module b
- page component b1
- page component b2
- ...
- page component bN
- child component b
- main component
Problem I am facing - When I am jumping from a page of child module a to a page of child module b only root component child module a, i.e. child component a, is getting destroy not the page components a1, a2, a3 ... aN. I can see those present in heap snapshots. This is bloating the memory.
Can anyone suggest me how to unload the entire module along with the components from memory? Or what I am doing wrong here?