@@ -202,7 +202,65 @@ onUnmounted(() => {
202202<div bind:this={container} style="width: 100%; height: 800px;"></div>
203203```
204204
205- ### 4. Vanilla JavaScript / HTML
205+ ### 4. Angular (v14+)
206+
207+ ``` typescript
208+ import { Component , ElementRef , ViewChild , AfterViewInit , OnDestroy } from ' @angular/core' ;
209+ import { QRLayoutDesigner } from ' qrlayout-ui' ;
210+ import ' qrlayout-ui/style.css' ;
211+
212+ @Component ({
213+ standalone: true ,
214+ selector: ' app-qr-designer' ,
215+ template: ' <div #container style="width: 100%; height: 800px;"></div>'
216+ })
217+ export class QrDesignerComponent implements AfterViewInit , OnDestroy {
218+ @ViewChild (' container' ) container! : ElementRef ;
219+ private designer? : QRLayoutDesigner ;
220+
221+ ngAfterViewInit() {
222+ this .designer = new QRLayoutDesigner ({
223+ element: this .container .nativeElement ,
224+ onSave : (data ) => console .log (' Saved Layout:' , data )
225+ });
226+ }
227+
228+ ngOnDestroy() {
229+ this .designer ?.destroy ();
230+ }
231+ }
232+ ```
233+
234+ ### 5. AngularJS (1.x)
235+
236+ ``` javascript
237+ import { QRLayoutDesigner } from ' qrlayout-ui' ;
238+ import ' qrlayout-ui/style.css' ;
239+
240+ angular .module (' myApp' , [])
241+ .component (' qrLayoutDesigner' , {
242+ template: ' <div class="designer-container" style="width: 100%; height: 800px;"></div>' ,
243+ controller: [' $element' , function ($element ) {
244+ let designer;
245+
246+ this .$onInit = () => {
247+ const container = $element[0 ].querySelector (' .designer-container' );
248+ designer = new QRLayoutDesigner ({
249+ element: container,
250+ onSave : (data ) => {
251+ console .log (' Saved Layout:' , data);
252+ }
253+ });
254+ };
255+
256+ this .$onDestroy = () => {
257+ if (designer) designer .destroy ();
258+ };
259+ }]
260+ });
261+ ```
262+
263+ ### 6. Vanilla JavaScript / HTML
206264
207265``` html
208266<!DOCTYPE html>
@@ -224,3 +282,4 @@ onUnmounted(() => {
224282</body >
225283</html >
226284```
285+
0 commit comments