Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Fixed "Back to Top" link bug #6512

Closed
wants to merge 1 commit into from
Closed

Fixed "Back to Top" link bug #6512

wants to merge 1 commit into from

Conversation

deini
Copy link

@deini deini commented Mar 2, 2014

Fixed bug where clicking Back to top was not actually taking you to the ...

#6499

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#6512)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

1 similar comment
@mary-poppins
Copy link

I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS.

Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match.

If you signed the CLA as a corporation, please let us know the company's name.

Thanks a bunch!

PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR.
PS2: If you are a Googler, please sign the CLA as well to simplify the CLA verification process.

@petebacondarwin
Copy link
Contributor

Hi @deini - thanks for sending in this PR and for digging down to find the template where the back-to-top link is. Unfortunately this is not quite the right fix. First, the {{ location.href }} interpolation binding will always evaluate to null since such expressions do not have access to the global namespace and are relative to the local AngularJS scope.

Despite this your fix appears to give us the required functionality but not if you are currently browsing to a URL that contains a hash, e.g. http://docs.angularjs.org/api/ng#service. When you click the link it just returns to where this tag was. I believe the intention of return to top links is literally to get to the top of the page.

So the real fix is to notice that the anchor has a directive on it: back-to-top. Looking in the docs/app/directive.js file shows us this directive. The fix is to change the hash part of the location in there before triggering the anchorScroll.

@deini
Copy link
Author

deini commented Mar 2, 2014

@petebacondarwin Thanks for your detailed response!

@petebacondarwin
Copy link
Contributor

@deini - you're welcome. Do keep finding and fixing issues!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants