Skip to content

Instantly share code, notes, and snippets.

@ShilpaLalwani
Last active April 15, 2020 06:05
Show Gist options
  • Save ShilpaLalwani/fd2b996f4109b62a377ea2a40d263442 to your computer and use it in GitHub Desktop.
Save ShilpaLalwani/fd2b996f4109b62a377ea2a40d263442 to your computer and use it in GitHub Desktop.
import { NgModule ,Injector, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { createCustomElement } from '@angular/elements';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { faHeart, faShareSquare } from '@fortawesome/free-regular-svg-icons';
import { MaterialModule } from './material-module';
import { CardComponent } from './card/card.component'
@NgModule({
imports: [ BrowserModule, MaterialModule, FontAwesomeModule ],
declarations: [ CardComponent ],
entryComponents : [ CardComponent ],
schemas: [
CUSTOM_ELEMENTS_SCHEMA // Tells Angular we will have custom tags in our templates
]
})
export class AppModule {
constructor(private injector: Injector, private library: FaIconLibrary) {
library.addIcons(faHeart, faShareSquare);
}
ngDoBootstrap() {
const el = createCustomElement(CardComponent, {
injector: this.injector
});
// using built in the browser to create your own custome element name
customElements.define('custom-card', el);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment