Skip to content

Commit dab394c

Browse files
ASG\borja.ruizvalorkin
authored andcommitted
fix(popover): prevent ng router active link double ngOnInit issue
1 parent 6bfd8e6 commit dab394c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/popover/popover.directive.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class PopoverDirective implements OnInit, OnDestroy {
5454
@Output() public onHidden: EventEmitter<any>;
5555

5656
private _popover: ComponentLoader<PopoverContainerComponent>;
57+
private _isInited = false;
5758

5859
public constructor(_elementRef: ElementRef,
5960
_renderer: Renderer,
@@ -113,6 +114,12 @@ export class PopoverDirective implements OnInit, OnDestroy {
113114
}
114115

115116
public ngOnInit(): any {
117+
// fix: seems there are an issue with `routerLinkActive`
118+
// which result in duplicated call ngOnInit without call to ngOnDestroy
119+
// read more: https://github.com/valor-software/ngx-bootstrap/issues/1885
120+
if (this._isInited) { return; }
121+
this._isInited = true;
122+
116123
this._popover.listen({
117124
triggers: this.triggers,
118125
show: () => this.show()

0 commit comments

Comments
 (0)