View source Improve this doc

$anchorScroll

service in module ng

Description

When called, it checks current value of $location.hash() and scroll to related element, according to rules specified in Html5 spec.

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

Dependencies

  • $window
  • $location
  • $rootScope

Usage

  1. $anchorScroll();

Example

Source

  1.  
  1.  
  1.  

Demo