Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
export class SystemLazyLoadService {
static $inject = ["$ocLazyLoad"];
constructor($ocLazyLoad) {
this.$ocLazyLoad = $ocLazyLoad;
load(src, moduleExportKey) {
let loader = this.$ocLazyLoad;
return System.import(src)
.then(module => {
var angularModule = module[moduleExportKey || 'default'];
if (!angularModule) {;
throw new Error("Unexpected angular module");
return loader.load(angularModule);
.then(() => {
return null; // !!! critical here; this is needed to trick future state infra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.