Here is my problem : I would like to make a single page application where AngularJS apps could be loaded/unloaded on the fly in a "main content" section, when clicking on different entries of a menu.
But I just can't figure out how to make this. I'm always getting the ng:btstrpd error when using the angular.bootstrap function.
I load the apps using the following code :
var mainContent = document.getElementById('main-content');
window.loadApp = function(modules) {
angular.bootstrap(mainContent, modules);
}
Here is a jsfiddle : http://jsfiddle.net/010b62ry/
I tried to remove the DOM element and reinsert it again but I get weird behaviors (like duplicates). I think the modules are not unloaded.
I also have tons of <!-- ngView: --> comments while doing so.
Anyone has a good idea about how to implement this ? Bonus point if the memory gets released when switching from one application to another.
PS: I really need to bootstrap 100% independant modules (who manage their own routes etc) because some of them could be developed by other people who do not have access to the source code of this application. I just need to start their modules as 100% autonomous angular applications.