Skip to content

Instantly share code, notes, and snippets.

@AbhiAgarwal192
Created April 17, 2021 09:08
Show Gist options
  • Save AbhiAgarwal192/bbb080938d8b937bba5faccd6545a9a3 to your computer and use it in GitHub Desktop.
Save AbhiAgarwal192/bbb080938d8b937bba5faccd6545a9a3 to your computer and use it in GitHub Desktop.
App Module
import { Injector, NgModule } from '@angular/core';
import { createCustomElement } from '@angular/elements';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { HelloWorldComponent } from './hello-world/hello-world.component';
@NgModule({
declarations: [
AppComponent,
HelloWorldComponent
],
imports: [
BrowserModule
],
providers: [],
entryComponents:[HelloWorldComponent],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(private injector: Injector){
}
ngDoBootstrap() {
const myCustomElement = createCustomElement(HelloWorldComponent, { injector: this.injector });
customElements.define('app-hello-world', myCustomElement);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment