From 59c090127f3f41ccf4ad902abcc543f0dcef0a18 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Mon, 7 Jul 2014 13:47:37 -0700 Subject: [PATCH] docs($anchorScroll): update example to use a module --- src/ng/anchorScroll.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/ng/anchorScroll.js b/src/ng/anchorScroll.js index 749d693d..3b25bfe4 100644 --- a/src/ng/anchorScroll.js +++ b/src/ng/anchorScroll.js @@ -17,24 +17,26 @@ * 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'); + angular.module('anchorScrollExample', []) + .controller('ScrollController', ['$scope', '$location', '$anchorScroll', + function ($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(); - }; - } + // call $anchorScroll() + $anchorScroll(); + }; + }]); #scrollArea {