From a8e3fd58b50654008ba67fc0109872239ba7e494 Mon Sep 17 00:00:00 2001 From: Weizheng Gao <44440575+WeizhengSap@users.noreply.github.com> Date: Wed, 2 Jun 2021 15:21:49 -0300 Subject: [PATCH] fix: Storefront crashes while injecting ModalService before app bootstrap (#12648) --- .../src/shared/components/modal/modal.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/storefrontlib/src/shared/components/modal/modal.service.ts b/projects/storefrontlib/src/shared/components/modal/modal.service.ts index cdc45c01339..7c3e737f723 100644 --- a/projects/storefrontlib/src/shared/components/modal/modal.service.ts +++ b/projects/storefrontlib/src/shared/components/modal/modal.service.ts @@ -31,8 +31,9 @@ export class ModalService { protected featureConfigService?: FeatureConfigService ) {} - protected readonly rootComponent = this.applicationRef?.components?.[0] - .location?.nativeElement; + protected get rootComponent() { + return this.applicationRef?.components?.[0]?.location?.nativeElement; + } open(content: any, options?: ModalOptions): ModalRef { let activeModal: ModalRef;