Skip to content

Commit

Permalink
fix: menu service subscription leak + minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed May 5, 2017
1 parent 9ea672d commit bb00dc3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/services/menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface MenuItem {
active?: boolean;
ready?: boolean;

depth?: number;
depth?: string|number;
flatIdx?: number;

metadata?: any;
Expand Down Expand Up @@ -72,7 +72,11 @@ export class MenuService {
this.buildMenu();
});

this._scrollSubscription = scrollService.scroll.subscribe((evt) => {
this.subscribe();
}

subscribe() {
this._scrollSubscription = this.scrollService.scroll.subscribe((evt) => {
this.onScroll(evt.isScrolledDown);
});

Expand Down Expand Up @@ -478,5 +482,6 @@ export class MenuService {
destroy() {
this._hashSubscription.unsubscribe();
this._scrollSubscription.unsubscribe();
this._progressSubscription.unsubscribe();
}
}

0 comments on commit bb00dc3

Please sign in to comment.