Skip to content

Commit

Permalink
fix(popover): prevent ng router active link double ngOnInit issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ASG\borja.ruiz authored and valorkin committed Jun 2, 2017
1 parent 6bfd8e6 commit dab394c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/popover/popover.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class PopoverDirective implements OnInit, OnDestroy {
@Output() public onHidden: EventEmitter<any>;

private _popover: ComponentLoader<PopoverContainerComponent>;
private _isInited = false;

public constructor(_elementRef: ElementRef,
_renderer: Renderer,
Expand Down Expand Up @@ -113,6 +114,12 @@ export class PopoverDirective implements OnInit, OnDestroy {
}

public ngOnInit(): any {
// fix: seems there are an issue with `routerLinkActive`
// which result in duplicated call ngOnInit without call to ngOnDestroy
// read more: https://github.com/valor-software/ngx-bootstrap/issues/1885
if (this._isInited) { return; }
this._isInited = true;

this._popover.listen({
triggers: this.triggers,
show: () => this.show()
Expand Down

0 comments on commit dab394c

Please sign in to comment.