I am trying to use Angular Elements to migrate from AngularJS and had an AE custom component working, I did a merge and it stops working.
The custom element gets loaded and I can see the text from it, however, I don't see any of my angular components or angular material components. The constructor and ngOnInit both fires. So It can't seem to find either my components or angular material.
app.module.ts
import { D6LargeMenuItemComponent } from "./component/d6-large-menu-item/d6-large-menu-item.component";
import { LargeMenuComponent } from "./component/large-menu/large-menu.component";
import { BrowserModule } from "@angular/platform-browser";
import { NgModule, Injector } from "@angular/core";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import {
MatCardModule,
MatButtonModule,
} from "@angular/material";
import { createCustomElement } from "@angular/elements";
import { D6OrderComponent } from "./component/d6-order/d6-order.component";
@NgModule({
declarations: [
D6OrderComponent,
LargeMenuComponent,
D6LargeMenuItemComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
MatButtonModule,
MatCardModule
],
entryComponents: [D6OrderComponent],
providers: []
// bootstrap: [AppComponent]
})
export class AppModule {
constructor(injector: Injector) {
const d6Order = createCustomElement(D6OrderComponent, { injector });
customElements.define('d6-order', d6Order);
}
ngDoBootstrap() { }
}
d6-order.companent.html
<div>
<!-- this shows up -->
d6-large menu 4
<!-- this shows up -->
<button mat-button color="primary">Primary</button>
<!-- this shows up -->
<button>dumb button</button>
<d6-large-menu [itemList]='itemList'></d6-large-menu>
</div>