1
1
import {
2
+ ChangeDetectorRef ,
2
3
ComponentRef ,
3
4
Directive ,
4
5
ElementRef ,
@@ -91,10 +92,11 @@ export class PopoverDirective implements OnChanges, OnDestroy, OnInit {
91
92
} ;
92
93
93
94
constructor (
94
- @Inject ( DOCUMENT ) private document : any ,
95
+ @Inject ( DOCUMENT ) private document : Document ,
95
96
private renderer : Renderer2 ,
96
97
private hostElement : ElementRef ,
97
98
private viewContainerRef : ViewContainerRef ,
99
+ private changeDetectorRef : ChangeDetectorRef ,
98
100
private listenersService : ListenersService
99
101
) { }
100
102
@@ -196,6 +198,7 @@ export class PopoverDirective implements OnChanges, OnDestroy, OnInit {
196
198
this . renderer . removeClass ( this . popover , 'd-none' ) ;
197
199
this . popoverRef . instance . visible = this . visible ;
198
200
this . popperInstance . forceUpdate ( ) ;
201
+ this . changeDetectorRef . markForCheck ( ) ;
199
202
} , 100 ) ;
200
203
} ) ;
201
204
}
@@ -205,8 +208,9 @@ export class PopoverDirective implements OnChanges, OnDestroy, OnInit {
205
208
if ( ! this . popoverRef ) {
206
209
return ;
207
210
}
208
- this . popoverRef . instance . visible = this . visible ;
211
+ this . popoverRef . instance . visible = false ;
209
212
this . popoverRef . instance . id = undefined ;
213
+ this . changeDetectorRef . markForCheck ( ) ;
210
214
setTimeout ( ( ) => {
211
215
this . viewContainerRef . detach ( ) ;
212
216
} , 300 ) ;
0 commit comments