Hi @omarkh3,
From what you shared, it looks like the Angular app is not bootstrapping properly within the AEM DOM. Here are a few things to check and fix:
1. Add a Bootstrap Target in the DOM
Angular needs a known element to bootstrap into. Add this in your HTL or HTML:
<div id="angular-app">
<app-hero></app-hero>
</div>
2. Update main.ts to Bootstrap to a Specific DOM Element
By default, Angular boots to index.html, which AEM doesn’t use. Modify main.ts like this:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
});
Make sure your AppModule bootstraps HeroComponent or has routing set up correctly to load it.
3. Check That Your JS Files Are Actually Loading
Use browser dev tools (Network tab) to confirm that:
-
runtime.js, polyfills.js, and main.js are loading.
-
clientlibs-angular/js.txt is not empty and properly lists the JS files.
4. Use allowProxy="true" and Access JS via Dispatcher/Author URL
Make sure your clientlibs-angular/.content.xml has:
<jcr:root
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
categories="[myproject.angular]"
allowProxy="{Boolean}true"/>
This ensures AEM serves the files via /etc.clientlibs/.
Hope that helps!