Skip to content

Commit eacfa4f

Browse files
committed
fix(popover): css .show class not binding to the popover element
1 parent 18a0bc6 commit eacfa4f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

projects/coreui-angular/src/lib/popover/popover.directive.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
ChangeDetectorRef,
23
ComponentRef,
34
Directive,
45
ElementRef,
@@ -91,10 +92,11 @@ export class PopoverDirective implements OnChanges, OnDestroy, OnInit {
9192
};
9293

9394
constructor(
94-
@Inject(DOCUMENT) private document: any,
95+
@Inject(DOCUMENT) private document: Document,
9596
private renderer: Renderer2,
9697
private hostElement: ElementRef,
9798
private viewContainerRef: ViewContainerRef,
99+
private changeDetectorRef: ChangeDetectorRef,
98100
private listenersService: ListenersService
99101
) {}
100102

@@ -196,6 +198,7 @@ export class PopoverDirective implements OnChanges, OnDestroy, OnInit {
196198
this.renderer.removeClass(this.popover, 'd-none');
197199
this.popoverRef.instance.visible = this.visible;
198200
this.popperInstance.forceUpdate();
201+
this.changeDetectorRef.markForCheck();
199202
}, 100);
200203
});
201204
}
@@ -205,8 +208,9 @@ export class PopoverDirective implements OnChanges, OnDestroy, OnInit {
205208
if (!this.popoverRef) {
206209
return;
207210
}
208-
this.popoverRef.instance.visible = this.visible;
211+
this.popoverRef.instance.visible = false;
209212
this.popoverRef.instance.id = undefined;
213+
this.changeDetectorRef.markForCheck();
210214
setTimeout(() => {
211215
this.viewContainerRef.detach();
212216
}, 300);

0 commit comments

Comments
 (0)