diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts index 40b76cbfc8..bed4fab0da 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts @@ -54,7 +54,7 @@ export class LoadingDirective implements OnInit, OnDestroy { if (newValue && !this.rootNode) { this.rootNode = (this.componentRef.hostView as EmbeddedViewRef).rootNodes[0]; this.targetElement.appendChild(this.rootNode); - } else { + } else if (this.rootNode) { this.renderer.removeChild(this.rootNode.parentElement, this.rootNode); this.rootNode = null; }