ocLazyLoad
ocLazyLoad copied to clipboard
Initialize before loading as dependency
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?
I encounter the same issue. Hope someone can help.
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']
}
]);
}
}