
In View Engine, NgModule factories are created for each NgModule and loaded when the module is requested. Ivy doesn't generate the factories by design and only loads the module class, so it must be compiled after being loaded. PR Close #30704
25 lines
933 B
TypeScript
25 lines
933 B
TypeScript
import { NgModule } from '@angular/core';
|
|
import { ROUTES} from '@angular/router';
|
|
import { ElementsLoader } from './elements-loader';
|
|
import {
|
|
ELEMENT_MODULE_LOAD_CALLBACKS,
|
|
ELEMENT_MODULE_LOAD_CALLBACKS_AS_ROUTES,
|
|
ELEMENT_MODULE_LOAD_CALLBACKS_TOKEN
|
|
} from './element-registry';
|
|
import { LazyCustomElementComponent } from './lazy-custom-element.component';
|
|
|
|
@NgModule({
|
|
declarations: [ LazyCustomElementComponent ],
|
|
exports: [ LazyCustomElementComponent ],
|
|
providers: [
|
|
ElementsLoader,
|
|
{ provide: ELEMENT_MODULE_LOAD_CALLBACKS_TOKEN, useValue: ELEMENT_MODULE_LOAD_CALLBACKS },
|
|
|
|
// Providing these routes as a signal to the build system that these modules should be
|
|
// registered as lazy-loadable.
|
|
// TODO(andrewjs): Provide first-class support for providing this.
|
|
{ provide: ROUTES, useValue: ELEMENT_MODULE_LOAD_CALLBACKS_AS_ROUTES, multi: true },
|
|
],
|
|
})
|
|
export class CustomElementsModule { }
|