@zwitch-uat/elements-angular
Integrate Zwitch Elements into your Angular project.
Steps to integrate
Install the package
npm i @zwitch-uat/elements-angular
Import ZwitchAngularModule
& CUSTOM_ELEMENTS_SCHEMA
from '@angular/core'
import { ZwitchElementsModule } from '@zwitch-uat/elements-angular';
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
Import defineCustomElements
and call this function which registers zwitch-elements
import {defineCustomElements} from '@zwitch-uat/elements-core/loader'
defineCustomElements(window);
Add Module to the imports and set the custom schema
@NgModule({
declarations: [
AppComponent
],
imports: [
...
ZwitchElementsModule,
...
],
schemas:[CUSTOM_ELEMENTS_SCHEMA],
bootstrap: [AppComponent]
})
export class AppModule { }
That's it you are set to use elements across this module.
Note: To register elements at common place, call defineCustomElements
in main.ts
and import ZwitchElementsModule
in your lazy loaded modules.