Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module's config loaded via ocLazyLoad is not getting called #426

Open
venugopal-annamaneni opened this issue Aug 10, 2018 · 2 comments
Open

Comments

@venugopal-annamaneni
Copy link

Lazyload Config in Parent App

{
    name: "lazyload-module",
    files: ["http://link_to_lazyload_module_js"],
    reconfig: true,
    rerun: true
},

Module Code to be LazyLoaded


(function() {
    var __MODULE_NAME = "lazyload-module";

    var app = function(angular) {
        "use strict";

        angular.module(__MODULE_NAME, ["oc.lazyload"]).config(['$ocLazyLoadProvider', function($ocLazyLoadProvider) {
            $ocLazyLoadProvider.config({
                debug: true,
                events: true,
                modules: [{
                       name : 'module1_in_lazyload_module',
                       files : ["resource_link_11","resource_link_12"]
                },{
                       name : 'module2_in_lazyload_module',
                       files : ["resource_link_21","resource_link_22"]
                }]
            });
        }]);

        angular.module(__MODULE_NAME, __DEPS["module_deps"]).run(function($ocLazyLoad){

            $ocLazyLoad.load(["module1_in_lazyload_module","module2_in_lazyload_module"]).then(function (data) {

            });
        });

        return angular.module(__MODULE_NAME);
    };

    if ((typeof window !== "undefined" && window !== null ? window.angular : void 0) != null) {
        app(window.angular);
    } else if (typeof require === "function") {
        var angular = require("angular");
        app(angular);
    } else {
        throw new Error("Could not find angular on window nor via require()");
    }

    if (typeof module !== "undefined" && module !== null) {
        module.exports = __MODULE_NAME;
    }
}).call(this);

Issue
the config and run in the lazyload-module is not getting called when the module itself is loaded via lazyload from parent app.

What is the issue/mistake here ? Basically what am trying to do is recursively lazyload modules on demand and not everything in the parent app.

Config and run of lazyload-module is called when this is directly loaded in Parent App

@venugopal-annamaneni
Copy link
Author

If someone is looking at this issue and want a working demo, please let me know. I can setup plunker with my case.

@ramarivera
Copy link

Hey @venugopal-annamaneni, did you get it to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants