@@ -7,6 +7,7 @@ A framework-agnostic, embeddable UI for designing sticker layouts with QR codes.
77| Framework | Live Demo | Source Code |
88| :--- | :--- | :--- |
99| ** React** | [ Live Demo] ( https://qr-layout-designer.netlify.app/ ) | [ Source] ( https://github.com/shashi089/qr-code-layout-generate-tool/tree/main/examples/react-demo ) |
10+ | ** Angular** | [ Live Demo] ( https://qr-layout-designer-angular.netlify.app/ ) | [ Source] ( https://github.com/shashi089/qr-code-layout-generate-tool/tree/main/examples/angular-demo ) |
1011| ** Svelte 5** | [ Live Demo] ( https://qr-layout-designer-svelte.netlify.app/ ) | [ Source] ( https://github.com/shashi089/qr-code-layout-generate-tool/tree/main/examples/svelte-demo ) |
1112| ** Vue 3** | [ Live Demo] ( https://qr-layout-designer-vue.netlify.app/ ) | [ Source] ( https://github.com/shashi089/qr-code-layout-generate-tool/tree/main/examples/vue-demo ) |
1213
@@ -202,10 +203,10 @@ onUnmounted(() => {
202203<div bind:this={container} style="width: 100%; height: 800px;"></div>
203204```
204205
205- ### 4. Angular (v14+ )
206+ ### 4. Angular (v17+ Standalone )
206207
207208``` typescript
208- import { Component , ElementRef , ViewChild , AfterViewInit , OnDestroy } from ' @angular/core' ;
209+ import { Component , ElementRef , ViewChild , OnInit , OnDestroy } from ' @angular/core' ;
209210import { QRLayoutDesigner } from ' qrlayout-ui' ;
210211import ' qrlayout-ui/style.css' ;
211212
@@ -214,15 +215,17 @@ import 'qrlayout-ui/style.css';
214215 selector: ' app-qr-designer' ,
215216 template: ' <div #container style="width: 100%; height: 800px;"></div>'
216217})
217- export class QrDesignerComponent implements AfterViewInit , OnDestroy {
218- @ViewChild (' container' ) container! : ElementRef ;
218+ export class QrDesignerComponent implements OnInit , OnDestroy {
219+ @ViewChild (' container' , { static: true } ) container! : ElementRef ;
219220 private designer? : QRLayoutDesigner ;
220221
221- ngAfterViewInit() {
222- this .designer = new QRLayoutDesigner ({
223- element: this .container .nativeElement ,
224- onSave : (data ) => console .log (' Saved Layout:' , data )
225- });
222+ ngOnInit() {
223+ if (this .container ?.nativeElement ) {
224+ this .designer = new QRLayoutDesigner ({
225+ element: this .container .nativeElement ,
226+ onSave : (data ) => console .log (' Saved Layout:' , data )
227+ });
228+ }
226229 }
227230
228231 ngOnDestroy() {
0 commit comments