ocombe / ocLazyLoad

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

Provide config block after defining modules #392

Open thatisuday opened 7 years ago

thatisuday commented 7 years ago

I have more than 10 dependencies and most of them need configurations. That means I need to pass them through angular.config. Since I don't want to load them synchronously in browser, this step can't be achieved. I have looked everywhere but I didn't find anything about ocLazyLoad helping to eliminate this. Event for defining routes in ui.router, you need to load ui-router.js file synchronously.

I was looking for something like this

.config(['$ocLazyLoadProvider', function($ocLazyLoadProvider) {
    $ocLazyLoadProvider.config({
        modules: [{
            name: 'uiRouter',
            files: ['/bower/angular-ui-router/release/angular-ui-router.min.js'],
            config : ['$stateProvider', function($stateProvider){
                $stateProvider.state('signin', {...});
            }]
        }]
    });
}]);

Please let me know If I am wrong somewhere or we can still achieve this...