Skip to content

Commit 1a8d3c8

Browse files
chore(docs): fix back-to-top anchor in angularjs.org doc pages
Closes angular/angularjs.org#45
1 parent 753687e commit 1a8d3c8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/src/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ <h2>Would you like full offline support for this AngularJS Docs App?</h2>
364364

365365
<footer class="footer">
366366
<div class="container">
367-
<p class="pull-right"><a href="#">Back to top</a></p>
367+
<p class="pull-right"><a back-to-top href="#">Back to top</a></p>
368368

369369
<p>
370370
Super-powered by Google ©2010-2012

docs/src/templates/js/docs.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,21 @@ docsApp.directive.errorDisplay = ['$location', 'errorLinkFilter', function ($loc
372372
}];
373373

374374

375+
/**
376+
* backToTop Directive
377+
* @param {Function} $anchorScroll
378+
*
379+
* @description Ensure that the browser scrolls when the anchor is clicked
380+
*/
381+
docsApp.directive.backToTop = ['$anchorScroll', function($anchorScroll) {
382+
return function link(scope, element) {
383+
element.on('click', function(event) {
384+
scope.$apply($anchorScroll);
385+
});
386+
};
387+
}];
388+
389+
375390
docsApp.serviceFactory.angularUrls = function($document) {
376391
var urls = {};
377392

0 commit comments

Comments
 (0)