• Overview
@angular/common

ViewportScroller

Class

Defines a scroll position manager. Implemented by BrowserViewportScroller.

  
    abstract class ViewportScroller {}
  
  

setOffset

void

Configures the top offset used when scrolling to an anchor.

@paramoffset[number, number] | (() => [number, number])

A position in screen coordinates (a tuple with x and y values) or a function that returns the top offset position.

@returnsvoid

getScrollPosition

[number, number]

Retrieves the current scroll position.

@returns[number, number]

scrollToPosition

void

Scrolls to a specified position.

@paramposition[number, number]

A position in screen coordinates (a tuple with x and y values).

@returnsvoid

scrollToAnchor

void

Scrolls to an anchor element.

@paramanchorstring

The ID of the anchor element.

@returnsvoid

setHistoryScrollRestoration

void

Disables automatic scroll restoration provided by the browser. See also window.history.scrollRestoration info.

@paramscrollRestoration"auto" | "manual"
@returnsvoid
Jump to details