Skip to content

Commit

Permalink
fix(dropdown): prevent ng router active link double ngOnInit issue
Browse files Browse the repository at this point in the history
read more: #1885
refs #1885
  • Loading branch information
valorkin committed Apr 10, 2017
1 parent dfe508f commit 7ded538
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dropdown/bs-dropdown.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class BsDropdownDirective implements OnInit, OnDestroy {
private _isDisabled: boolean;
private _dropdown: ComponentLoader<BsDropdownContainerComponent>;
private _subscriptions: Subscription[] = [];
private _isInited = false;

constructor(private _elementRef: ElementRef,
private _renderer: Renderer,
Expand All @@ -129,6 +130,12 @@ export class BsDropdownDirective implements OnInit, OnDestroy {
}

ngOnInit(): void {
// 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._showInline = !this.container;

// attach DOM listeners
Expand Down

0 comments on commit 7ded538

Please sign in to comment.