From 3ea2d7902196ed8af7c3cc76d815c53bb54d5778 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Thu, 3 Oct 2024 18:31:01 +0200 Subject: [PATCH] Fix Promise with useDefineForClassFields #10706 --- .../lib/natural-gallery/natural-gallery.component.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/angular-natural-gallery/src/lib/natural-gallery/natural-gallery.component.ts b/projects/angular-natural-gallery/src/lib/natural-gallery/natural-gallery.component.ts index 2115809..8807204 100644 --- a/projects/angular-natural-gallery/src/lib/natural-gallery/natural-gallery.component.ts +++ b/projects/angular-natural-gallery/src/lib/natural-gallery/natural-gallery.component.ts @@ -18,9 +18,7 @@ export class NaturalGalleryComponent; - public readonly gallery = new Promise>(resolve => { - this.resolve = resolve; - }); + public readonly gallery: Promise>; private resolve!: (value: Natural) => void; @@ -32,6 +30,12 @@ export class NaturalGalleryComponent gallery.setItems(items)); } + public constructor() { + this.gallery = new Promise>(resolve => { + this.resolve = resolve; + }); + } + public ngOnInit(): void { setTimeout(() => { const gallery = new Natural(this.galleryElement.nativeElement, this.options, this.scrollable);