diff --git a/src/ng/anchorScroll.js b/src/ng/anchorScroll.js index 0ddc9c78..a87995cf 100644 --- a/src/ng/anchorScroll.js +++ b/src/ng/anchorScroll.js @@ -10,8 +10,36 @@ * according to rules specified in * {@link http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document Html5 spec}. * - * It also watches the `$location.hash()` and scroll whenever it changes to match any anchor. + * It also watches the `$location.hash()` and scrolls whenever it changes to match any anchor. * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`. + * + * @example + + +
+ Go to bottom + You're at the bottom! +
+
+ + function ScrollCtrl($scope, $location, $anchorScroll) { + $scope.gotoBottom = function (){ + // set the location.hash to the id of + // the element you wish to scroll to. + $location.hash('bottom'); + + // call $anchorScroll() + $anchorScroll(); + } + } + + + #bottom { + display: block; + margin-top: 2000px; + } + +
*/ function $AnchorScrollProvider() {