3

I want to unload all used modules when a user logs out of the webside to reset the application. When a new logs into the backendserver with the same running application all lazy loaded modules are still there. I did some research and seems to me like it isn't possible by now.

Does somebody know a solution or a githublink to the ticket?

lynxSven
  • 555
  • 1
  • 10
  • 27

2 Answers2

3

I guess unloading my modules was the wrong direction.

Once the chunks are loaded they shouldn't be constructed again.

I register the services in another service. Now when I Logout I call a function which iterates through all the services and calls a function for every service which empties all data by the previous User.

----------EDIT---------

Seeing that this question still get views here is a solution I used for some Apps:

Kudos to user benh80

Resetting the complete App and reloading it: Resetting Angular 2 App

lynxSven
  • 555
  • 1
  • 10
  • 27
  • I thinks is a good question, for example one admin user access to the lasy loaded component on certain module and then the use sign out the app. Even the user cannot access to the module because permissions , the code loades still remaind on browser so is a valid question in this case. – rolivares May 19 '23 at 15:07
0

the whole point of using lazy loading is to load the relevant modules for a component. Once you log out the application it actually loads the modules which need for that component. Hence there is nothing to unload

Sachila Ranawaka
  • 39,756
  • 7
  • 56
  • 80