Install and set up @angular-extensions/elements
masterTo use @angular-extensions/elements for lazy-loading Angular Elements or web components in your Angular application, follow these steps:
- Install the package via npm:
npm i @angular-extensions/elements - Import
LazyElementDirectivefrom@angular-extensions/elements. - Add
LazyElementDirectiveto theimportsarray of your Angular component. - Add
CUSTOM_ELEMENTS_SCHEMAto theschemasarray of your@Componentdecorator to allow the use of non-Angular custom elements. - Apply the
*axLazyElementstructural directive to the HTML element you want to lazy-load, passing the URL of the element bundle as the argument.
npm i @angular-extensions/elements