docs(directives): ensure that the back-to-top directive resets location

Closes #6512
Closes #6499
This commit is contained in:
Peter Bacon Darwin
2014-03-02 15:37:09 +00:00
parent d7ecab775c
commit 27b7fa3914
2 changed files with 3 additions and 2 deletions

View File

@@ -10,9 +10,10 @@ angular.module('directives', [])
*
* @description Ensure that the browser scrolls when the anchor is clicked
*/
.directive('backToTop', ['$anchorScroll', function($anchorScroll) {
.directive('backToTop', ['$anchorScroll', '$location', function($anchorScroll, $location) {
return function link(scope, element) {
element.on('click', function(event) {
$location.hash('');
scope.$apply($anchorScroll);
});
};