ocombe / ocLazyLoad

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

Loading as module issues #387

Open m0ngr31 opened 7 years ago

m0ngr31 commented 7 years ago

Trying to do something like this:

angular.module('ec', ['oc.lazyLoad', 'ec.charts'])
.config(function($ocLazyLoadProvider) {
  $ocLazyLoadProvider.config({
    'modules': [{
      name : 'chart.js',
      files: [
        '/bower_components/chart.js/dist/Chart.bundle.min.js',
        '/bower_components/angular-chart.js/dist/angular-chart.min.js'
      ],
      serie: true
    }]
  });
});

angular.module('ec.charts', [['chart.js']]);

Results in an error: Error: [$injector:modulerr] Failed to instantiate module oc.lazyLoad due to: Error: [$injector:nomod] Module 'chart.js' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

I've also tried it this way and gotten the same error.

angular.module('ec.charts', [
  {
    name: 'chart.js',
    files: [
      '/bower_components/chart.js/dist/Chart.bundle.min.js',
      '/bower_components/angular-chart.js/dist/angular-chart.min.js'
    ]
  }
]);

Is there something I'm missing?