marcoslin / angularAMD

Facilitate use of RequireJS in AngularJS
http://marcoslin.github.io/angularAMD
MIT License
734 stars 171 forks source link

previous controllers js should not be in loaded state. #149

Closed vaneshmali closed 9 years ago

vaneshmali commented 9 years ago

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?

marcoslin commented 9 years ago

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:

http://stackoverflow.com/questions/18520963/requirejs-how-do-i-unload-previously-loaded-javascript-file-aka-exclusive-depe