Trying to implement lazy load using Requirejs and AngularAMD utility with angularjs.
Everything is fine.
The problem is I have number of controllers, so when I want to load addUserCtrl.js, it get loaded. I am happy that other controller js not loaded yet.
Now the issue rises: when I load allUsersCtrl.js, it get loaded, but addUserCtrl.js is also still loaded. So what I want the previous controllers js should not be in loaded state. Because the application is having number of controllers.
I do not know of any clean way of unloading a JS file from a browser other than closing the page. There are many answers in SO about unload JS file but I like the following:
Trying to implement lazy load using Requirejs and AngularAMD utility with angularjs.
Everything is fine.
The problem is I have number of controllers, so when I want to load addUserCtrl.js, it get loaded. I am happy that other controller js not loaded yet.
Now the issue rises: when I load allUsersCtrl.js, it get loaded, but addUserCtrl.js is also still loaded. So what I want the previous controllers js should not be in loaded state. Because the application is having number of controllers.
How can I fix it?