ng new DropDownMenuComponent
Make sure to add this to the parent project not the library we are about to create.
ng add @angular/elements
ng generate library drop-down-menu
The parent project will be used to test our new custom element. So we will need to initialise it in the app.component
import {DropDownMenuComponent} from "../../projects/drop-down-menu/src/lib/drop-down-menu.component";
@NgModule({
entryComponents: [
DropDownMenuComponent
],
declarations: [
AppComponent,
DropDownMenuComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: []
})
export class AppModule {
constructor(injector: Injector) {
let dropDownMenuElement = createCustomElement(DropDownMenuComponent, {injector});
customElements.define('push-it', dropDownMenuElement);
}
}