Improve this Doc  View Source

$anchorScroll

  1. - $anchorScrollProvider
  2. - service in module ng

Overview

When called, it scrolls to the element related to the specified hash or (if omitted) to the current value of $location.hash(), according to the rules specified in the HTML5 spec.

It also watches the $location.hash() and automatically scrolls to match any anchor whenever it changes. This can be disabled by calling $anchorScrollProvider.disableAutoScrolling().

Additionally, you can use its yOffset property to specify a vertical scroll-offset (either fixed or dynamic).

Dependencies

Usage

$anchorScroll([hash]);

Arguments

Param Type Details
hash
(optional)
string

The hash specifying the element to scroll to. If omitted, the value of $location.hash() will be used.

Properties