Skip to content

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

@venugopal-annamaneni

Description

@venugopal-annamaneni

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions