ocLazyLoad icon indicating copy to clipboard operation
ocLazyLoad copied to clipboard

Initialize before loading as dependency

Open udayms opened this issue 8 years ago • 2 comments

Hi... I am trying to test the agGrid component in my project. I already have a running setup of ocLazyLoad working fine in my project. Typically, I define the modules in a config file and then load that config in my ui-router. But, agGrid documentation wants me to register the library as a angular module before I load it as a dependency.

// get ag-Grid to create an Angular module and register the ag-Grid directive agGrid.initialiseAgGridWithAngular1(angular); // create your module with ag-Grid as a dependency var module = angular.module("example", ["agGrid"]);

How can I do this?

udayms avatar Sep 18 '16 18:09 udayms

I encounter the same issue. Hope someone can help.

tsukihimeNyo avatar Oct 09 '16 16:10 tsukihimeNyo

Just solve the problem by adding the agGrid.initialiseAgGridWithAngular1(angular) before return $ocLazyLoad.load ,

            resolve: {
                loadPlugin: function ($ocLazyLoad) {
                    agGrid.initialiseAgGridWithAngular1(angular);
                    return $ocLazyLoad.load([
                        {
                            name: 'agGrid',
                            files: ['js/plugins/ag-grid/ag-grid.min.js']
                        }
                    ]);
                }
            }

tsukihimeNyo avatar Oct 09 '16 16:10 tsukihimeNyo