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

chore(docs/docModuleComponents): allow browser to scroll to anchors #4723

Closed

Conversation

petebacondarwin
Copy link
Contributor

This directive, in the documentation application, creates new HTML that contains anchors.
If we link to one of these anchors we need to give the browser the opportunity to scroll
to them after they have been rendered.
An example of such an anchor would be http://docs.angularjs.org/api/ng#directive

This directive, in the documentation application, creates new HTML that contains anchors.
If we link to one of these anchors we need to give the browser the opportunity to scroll
to them after they have been rendered.
An example of such an anchor would be http://docs.angularjs.org/api/ng#directive
link: function() {
// This directive creates new HTML that contains anchors. We need to give the browser the
// opportunity to scroll to them after they have been rendered.
$timeout($anchorScroll);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the autoscroll on ngInclude sufficient?

https://github.com/petebacondarwin/angular.js/blob/ec2db151336a4eeb44d7f6fb59e9411416ee2cf2/docs/src/templates/index.html#L336

the use of $timeout just tells me that we have some ordering issue somewhere and timeout seems to fix it, but if whatever is delaying rendering takes longer than the amount of delay timeout gives us the autoscroll will not work once again.

@petebacondarwin
Copy link
Contributor Author

I've got a feeling it is down to the animations...

@petebacondarwin
Copy link
Contributor Author

I didn't realise that ngInclude had this autoscroll feature.
The fix is in there: we need to call $autoScroll in the done handler of the animation.
I'll put together a pull request.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this pull request Nov 2, 2013
We need to wait until animations have added the content to the document before
trying to `autoscroll` to anchors that may have been inserted.

Fixes angular#4723
jeffbcross pushed a commit to jeffbcross/angular.js that referenced this pull request Nov 6, 2013
We need to wait until animations have added the content to the document before
trying to `autoscroll` to anchors that may have been inserted.

Fixes angular#4723
petebacondarwin added a commit that referenced this pull request Nov 6, 2013
We need to wait until animations have added the content to the document before
trying to `autoscroll` to anchors that may have been inserted.

Fixes #4723
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
We need to wait until animations have added the content to the document before
trying to `autoscroll` to anchors that may have been inserted.

Fixes angular#4723
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
We need to wait until animations have added the content to the document before
trying to `autoscroll` to anchors that may have been inserted.

Fixes angular#4723
@petebacondarwin petebacondarwin deleted the docModuleComponents branch February 11, 2014 09:56
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.

2 participants