forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo-app.module.ts
More file actions
47 lines (42 loc) · 1.38 KB
/
demo-app.module.ts
File metadata and controls
47 lines (42 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {CUSTOM_ELEMENTS_SCHEMA, Injector, NgModule} from '@angular/core';
import {createCustomElement} from '@angular/elements';
import {RouterModule} from '@angular/router';
import {initializeMessageBus} from 'ng-devtools-backend';
import {ZoneUnawareIFrameMessageBus} from '../../zone-unaware-iframe-message-bus';
import {DemoAppComponent} from './demo-app.component';
import {HeavyComponent} from './heavy.component';
import {ZippyComponent} from './zippy.component';
@NgModule({
declarations: [DemoAppComponent, HeavyComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
exports: [DemoAppComponent],
imports: [
RouterModule.forChild([
{
path: '',
component: DemoAppComponent,
children: [
{
path: '',
loadChildren: () => import('./todo/app.module').then((m) => m.AppModule),
},
],
},
]),
],
})
export class DemoAppModule {
constructor(injector: Injector) {
const el = createCustomElement(ZippyComponent, {injector});
customElements.define('app-zippy', el as any);
}
}
initializeMessageBus(new ZoneUnawareIFrameMessageBus(
'angular-devtools-backend', 'angular-devtools', () => window.parent));