Skip to content
@ng-doc/app / Class

NgDocSidebarService

Service for sidebar, it can be used to hide/show sidebar or to check if sidebar is collapsable.

On wide screens the sidebar is always shown. At NG_DOC_SIDEBAR_COLLAPSE_WIDTH and below it is an overlay: show() opens it and blocks page scrolling, hide() closes it, and a navigation or a resize to a wide screen ends the overlay.

Decorators
@Service
DeclarationTypeScript
@Service()
export class NgDocSidebarService { … }

Members

Constructor

1
()
—

Properties

6
document: Document
protectedreadonly
—
expanded: BehaviorSubject<boolean>
protectedreadonly
—
expandedState: Signal<boolean>
readonly

Whether the sidebar is shown, as a signal. It follows the same state as isExpanded().

router: Router
protectedreadonly
—
protectedreadonly
—
window: Window
protectedreadonly
—

Accessors

1
get isMobile: boolean

Whether the viewport is narrow enough for the sidebar to be an overlay.

Methods

4
(): void

Hide sidebar, and unblock scrolling.

(): Observable<boolean>

Indicates if sidebar is visible, based on the show/hide methods. Read expandedState for the same value as a signal.

(): void

Show sidebar, and block scrolling.

(): void

Toggle sidebar visibility.

Symbol
Kind
Class
Decorators
@Service
Scope
@ng-doc/app
Edit this page