ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

Question/Issue with overwriting angular.bootstrap #318

Open RomeroDiver opened 8 years ago

RomeroDiver commented 8 years ago

Hi, I am trying to use this module to lazy load my angular modules. It works very well apart from one problem - I have manual bootstrap of the projects made like that:

angular.element(document).ready(function() {
      var options = {
        strictDi: true
      };
      try {
        angular.bootstrap(document, ['appDev'], options);
      } catch (err) {
        angular.bootstrap(document, ['app'], options);
      }
    });

(the above code works like that: if appDev module exists it means that it's development environment and it should boostrap this module, but if there is no appDev module, then it means that it's production environemnt and it should bootstrap app with app module) Because ocLazyLoad overwrites bootstrap, it adds the appDev module to modulesToLoad array, and then in the catch it tries to load both modules. As far as I can see, there is no public method do clear modulesToLoad array. Or did I miss something?