Skip to content

Commit e4d6fc7

Browse files
committed
- new built plugins
- button to load remote component
1 parent c46f746 commit e4d6fc7

19 files changed

+26
-22
lines changed
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
const { withModuleFederation } = require('@nrwl/angular/module-federation');
22
const config = require('./module-federation.config');
3-
module.exports = withModuleFederation({
4-
...config
5-
});
3+
module.exports = withModuleFederation(config);

apps/shell/src/app/app.component.html

+2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ <h1>{{title}}</h1>
44
{{randomService.randomString$ | async}}
55
</p>
66

7+
<h3>Navigace</h3>
78
<ul class="remote-menu">
89
<li><a routerLink="/">Home</a></li>
910
<li><a routerLink="calendar">Calendar</a></li>
1011
</ul>
1112

1213
<div class="component">
1314
<h2>Nactena komponenta z calendar modulu:</h2>
15+
<button *ngIf="!isCalendarComponentLoaded" (click)="loadCalendarComponent()">Načíst...</button>
1416
<ng-template #cmpRef></ng-template>
1517
</div>
1618

apps/shell/src/app/app.component.scss

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
.component {
33
display: flex;
44
flex-direction: column;
5+
align-items: flex-start;
56
}
67
}

apps/shell/src/app/app.component.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,25 @@ export class AppComponent implements OnInit {
1515
public cmpStandaloneRef!: ViewContainerRef;
1616

1717
title = 'shell';
18+
isCalendarComponentLoaded = false;
1819

1920

2021
constructor(public randomService: RandomService) {
2122
}
2223

2324
ngOnInit() {
24-
25-
loadRemoteModule('calendar', './Component').then(container => {
26-
const {ExposedComponent} = container;
27-
this.cmpRef.createComponent(ExposedComponent);
28-
})
29-
3025
loadRemoteModule('standalone', './Component').then(container => {
3126
const {RemoteEntryComponent} = container;
3227
this.cmpStandaloneRef.createComponent(RemoteEntryComponent);
3328
})
3429

3530
}
31+
32+
loadCalendarComponent() {
33+
loadRemoteModule('calendar', './Component').then(container => {
34+
const {ExposedComponent} = container;
35+
this.cmpRef.createComponent(ExposedComponent);
36+
this.isCalendarComponentLoaded = true;
37+
})
38+
}
3639
}

apps/shell/src/assets/plugins/calendar/230.2e18c495d4860686.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/shell/src/assets/plugins/calendar/230.efe317ea9351ba4e.js

-1
This file was deleted.

apps/shell/src/assets/plugins/calendar/common.3fe60b0bdcfbcfd5.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/shell/src/assets/plugins/calendar/common.680c78edef8f2354.js

-1
This file was deleted.

apps/shell/src/assets/plugins/calendar/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<link rel="stylesheet" href="styles.ef46db3751d8e999.css"></head>
88
<body>
99
<ng-mfa-root></ng-mfa-root>
10-
<script src="polyfills.316c6d55b380706e.js" type="module"></script><script src="main.c5e033037f476461.js" type="module"></script>
10+
<script src="polyfills.ba175d55113dd864.js" type="module"></script><script src="main.944dc775c0bb0e7d.js" type="module"></script>
1111

1212
</body></html>

0 commit comments

Comments
 (0)