ocombe / ocLazyLoad

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

point people to Angular 1.6.7 and $injector.loadNewModules(modules) #411

Open graingert opened 6 years ago

graingert commented 6 years ago

see https://github.com/angular/angular.js/commit/6e78fee73258bb0ae36414f9db2e8734273e481b

$injector.loadNewModules(modules)

graingert commented 6 years ago

@ocombe might be worth deprecating ocLazyLoad?

Insidexa commented 6 years ago

How to declarate modules in bundleUrl ? Like a simple angular module or do you need to export this module ?

graingert commented 6 years ago
app.factory('loadModule', function($injector, $q) {
  return function loadModule(moduleName, bundleUrl) {
    return $q.resolve(import('./path/to/es/module')).then(function(v) { $injector.loadNewModules([v.default]); });
  };
})
BusbyActual commented 5 years ago

Is there an implementation of directives for that feature?

graingert commented 5 years ago

@BusbyActual what?

BusbyActual commented 5 years ago

You advocated for suggesting this library is deprecated and to suggested to use the $injector.loadNewModules method. How would one load a directive ?

graingert commented 5 years ago

@BusbyActual you declare the directive in the module you want to load

BusbyActual commented 5 years ago

@graingert

Previously compiled HTML will not be affected by newly loaded directives, filters and components.

If I'm reading this correctly directives will still be an issue.

graingert commented 5 years ago

Just make sure you compile html in loadModule(...).then(moduleName => { /* here */ })