mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-27 19:13:55 +08:00
docs(directives): ensure that the back-to-top directive resets location
Closes #6512 Closes #6499
This commit is contained in:
@@ -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);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user