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. |