Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ testem.log
Thumbs.db

.angular
.vs/module-federation-plugin/v17/.wsuo
2 changes: 2 additions & 0 deletions libs/mf-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ Some optional flags are offered to provide options for custom behavior of the `b
- Those versions introduced new features on how to share the Platform in the window object.
- This allows to use the `bootstrap()` function even in such cases, where the same version is packed into different micro frontend bundles.

The `WebComponentWrapper` component exposes the `onError` Output which is emitted if there is an error during loading of remote element into DOM

## More about the underlying ideas

Please find more information on the underlying ideas in this [blog article](https://www.angulararchitects.io/aktuelles/multi-framework-and-version-micro-frontends-with-module-federation-the-good-the-bad-the-ugly).
5 changes: 5 additions & 0 deletions libs/mf-tools/src/lib/web-components/web-component-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
Input,
OnChanges,
ViewChild,
Output,
EventEmitter
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {
Expand All @@ -26,6 +28,8 @@ export class WebComponentWrapper implements AfterContentInit, OnChanges {
@ViewChild('vc', { read: ElementRef, static: true })
vc: ElementRef;

@Output() onError: EventEmitter<unknown> = new EventEmitter();

@Input() options: WebComponentWrapperOptions;
@Input() props: { [prop: string]: unknown };
@Input() events: { [event: string]: (event: Event) => void };
Expand Down Expand Up @@ -66,6 +70,7 @@ export class WebComponentWrapper implements AfterContentInit, OnChanges {
this.vc.nativeElement.appendChild(this.element);
} catch (error) {
console.error(error);
this.onError.emit(error);
}
}
}