I am trying to download and deploy the module after the initial loading of the application. For example, let my original module:
angular.module('mainApp', []);
Later I understand that the user needs all the routes available through secondaryApp to open them. So now I need my module to look something like this:
angular.module('mainApp', ['secondaryApp']);
I have successfully lazyLoading the secondApp js file, but I cannot add it to mainApp. I tried adding it to the required array, i.e.
var app = angular.module('mainApp'); app.requires[app.requires.length] = 'secondaryApp';
This adds the module name to the require array, but mainApp still does not have access to the routes / states provided in secondaryApp .
Does anyone have any suggestions? I was stuck on this for a while.
Thanks!
source share