ViewportScroller
Manages the scroll position.
abstract class ViewportScroller {
static ngInjectableDef: defineInjectable({ providedIn: 'root', factory: () => new BrowserViewportScroller(inject(DOCUMENT), window) })
abstract setOffset(offset: [number, number] | (() => [number, number])): void
abstract getScrollPosition(): [number, number]
abstract scrollToPosition(position: [number, number]): void
abstract scrollToAnchor(anchor: string): void
abstract setHistoryScrollRestoration(scrollRestoration: 'auto' | 'manual'): void
}
Static properties
Property | Description |
---|---|
static ngInjectableDef: defineInjectable({ providedIn: 'root', factory: () => new BrowserViewportScroller(inject(DOCUMENT), window) })
|
Methods
Returns the current scroll position. |
ParametersThere are no parameters. Returns
|
Sets the scroll position. |
||
Parameters
Returns
|
Scrolls to the provided anchor. |
||
Parameters
Returns
|
Disables automatic scroll restoration provided by the browser. |
||
Parameters
Returns
|
||