Skip to content

Commit 859de3d

Browse files
committed
world map
1 parent 732da16 commit 859de3d

22 files changed

+5495
-45
lines changed

src/app/app.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-root',
5-
template: ``
5+
template: `
6+
<!-- <app-world-map [list]="exampleList"></app-world-map>-->
7+
<!-- <app-legend-map [list]="exampleList"></app-legend-map>-->`
68
})
79
export class AppComponent {
8-
title = '';
10+
exampleList = "['PL','RU','DE','CN']"
911
}

src/app/app.module.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33

44
import { AppComponent } from './app.component';
5-
import {ToggleComponent} from "./toggle.component";
5+
import {MapsModule} from "./map/maps.module";
66

77
@NgModule({
88
declarations: [
99
AppComponent
1010
],
1111
imports: [
12-
BrowserModule
12+
BrowserModule,
13+
MapsModule
1314
],
1415
providers: [],
1516
bootstrap: [AppComponent]

src/app/element.module.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {ApplicationRef, DoBootstrap, Injector, NgModule} from '@angular/core';
22
import {BrowserModule} from "@angular/platform-browser";
3-
import {ToggleComponent} from "./toggle.component";
43
import {createCustomElement} from "@angular/elements";
4+
import {WorldMapComponent} from "./map/world-map/world-map.component";
5+
import {MapsModule} from "./map/maps.module";
6+
import {LegendMapComponent} from "./map/legend-map/legend-map.component";
57

68
@NgModule({
79
imports: [
810
BrowserModule,
9-
ToggleComponent
11+
MapsModule
1012
],
1113
providers: [],
1214
})
@@ -17,16 +19,27 @@ export class ElementModule implements DoBootstrap {
1719
) {}
1820

1921
ngDoBootstrap(appRef: ApplicationRef) {
20-
if (!customElements.get('login-provider')) {
22+
if (!customElements.get('world-map')) {
2123
// Register only if 'login-provider' entry is not found in the registry
2224

2325
// Step 3: loginComponent stores the constructor class
24-
const loginComponent = createCustomElement(ToggleComponent, {
26+
const worldComponent = createCustomElement(WorldMapComponent, {
2527
injector: this.injector, // This injector is used to load the component's factory
2628
});
2729

2830
// Step 4: Registering custom tag 'login-provider' with the obtained custom class
29-
customElements.define('login-provider', loginComponent);
31+
customElements.define('world-map', worldComponent);
32+
}
33+
if (!customElements.get('world-legend-map')) {
34+
// Register only if 'login-provider' entry is not found in the registry
35+
36+
// Step 3: loginComponent stores the constructor class
37+
const worldLegendComponent = createCustomElement(LegendMapComponent, {
38+
injector: this.injector, // This injector is used to load the component's factory
39+
});
40+
41+
// Step 4: Registering custom tag 'login-provider' with the obtained custom class
42+
customElements.define('world-legend-map', worldLegendComponent);
3043
}
3144
}
3245
}

0 commit comments

Comments
 (0)