You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add schemas: [ CUSTOM_ELEMENTS_SCHEMA ], in the NgModule decorator of the Angular Module where your components will live.
Use Angular CLI to generate a component.
Refactor generated Component's import statement, decorator, constructor, and add a render function as seen in the example below.
Refactor the import statement of the Component in the parent Module from import { HelloWorldComponent } from './hello-world/hello-world.component' to import './hello-world/hello-world.component'
// hello-world.module.tsimport{NgModule,CUSTOM_ELEMENTS_SCHEMA}from'@angular/core';import{CommonModule}from'@angular/common';import'./hello-world/hello-world.component'
@NgModule({schemas: [CUSTOM_ELEMENTS_SCHEMA],imports: [CommonModule],declarations: [// HelloCaseComponent // We can't do this yet :(]})exportclassHelloWorldModule{}
Limitations
Angular will fail if you declare a Lit Element based Component in a Module thus you cannot expect Angular to inject services into your Lit Element based Component constructors.
Because of a bug in the current version of Webpack that Angular CLI uses, you can only target ES6 builds, thus support for older browsers is not currently possible. This may be fixed when Angular 8 is released.