From e0d1549fab9349dbc2f82c0836dd5223427f18da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chabbey=20Fran=C3=A7ois?= Date: Wed, 7 Feb 2024 08:12:06 +0100 Subject: [PATCH] Update README.md Add a quick example for standalone components --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index 2d7f205..429b79e 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,42 @@ export class FeatureComponent { } ``` +For standalone components, the modules and the schema are moved to the component declaration itself + +```typescript +import { Component } from '@angular/core'; +import { LazyElementsModule } from '@angular-extensions/elements'; + +@Component({ + selector: 'your-org-feature', + standalone: true, + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [ + LazyElementsModule, + // your own imports below + ] + template: ` + + + + `, +}) +export class FeatureComponent { + elementUrl = 'https://your-org.com/elements/some-element.js'; + + data: SomeData; + + handleChange(change: Partial) { + // ... + } +} +``` + + ## Supported Angular versions Library was tested with the following versions of Angular and is meant to be used