Last active
April 15, 2020 06:05
-
-
Save ShilpaLalwani/fd2b996f4109b62a377ea2a40d263442 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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