I am working on a micro front-end application using the Webpack 5 module federation with Angular 15. I am experiencing a strange issue where *ngIf
work as expected on the shell project, but not on the other micro front-ends.
The *ngIf
works fine when the page loads, but if any interaction is done to display a particular HTML using *ngIf
the HTML keeps adding rather than removing the old HTML. I am not sure what is causing this issue.
Has anyone else experienced this issue before? If so, what was the solution? Any help would be greatly appreciated. Thank you in advance!
As seen in the image below when triggering the switch it should switch the chart between employees and departments.
<div class="display-flex">
<mat-card-title class="display-flex">
<div class="display-flex">
<h1 *ngIf="!employeesDepartmentCheck">Employees</h1>
<h1 *ngIf="employeesDepartmentCheck">Departments</h1>
<span class="spacer"></span>
<mat-slide-toggle [checked]="employeesDepartmentCheck" (change)="onToggleEmpDep($event)"></mat-slide-toggle>
</div>
</mat-card-title>
</div>
Tried Importing the common module directly into the module declaration. Tested the ngif on the shell micro frontend and it worked normally.