Skip to content

Instantly share code, notes, and snippets.

@venkateshwarv
Created February 18, 2017 20:23
Show Gist options
  • Save venkateshwarv/02ee302b0052c6c47377933c862d34be to your computer and use it in GitHub Desktop.
Save venkateshwarv/02ee302b0052c6c47377933c862d34be to your computer and use it in GitHub Desktop.
Close observable consumption
// LifeCycle Hook that consumes the close observable from menu-directive
ngAfterViewInit() {
this._checkMenu();
this.menu.close.subscribe(() => this.closeMenu());
}
// closeMenu - actually closes the menu
/** Closes the menu. */
closeMenu(): void {
if (this._overlayRef) {
this._overlayRef.detach();
this._backdropSubscription.unsubscribe();
this._resetMenu();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment