ViewportScroller
Defines a scroll position manager. Implemented by BrowserViewportScroller
.
abstract class ViewportScroller {
static ngInjectableDef: defineInjectable({...})
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, inject(ErrorHandler))
})
|
Methods
Configures the top offset used when scrolling to an anchor. |
|||
Parameters
Returns
|
Retrieves the current scroll position. |
ParametersThere are no parameters. Returns
|
Scrolls to a specified position. |
|||
Parameters
Returns
|
Scrolls to an anchor element. |
|||
Parameters
Returns
|
Disables automatic scroll restoration provided by the browser. See also window.history.scrollRestoration info. |