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

ngRepeat with ngInclude and autoscroll doesn't seem to work #2637

Closed
nilsga opened this issue May 11, 2013 · 3 comments
Closed

ngRepeat with ngInclude and autoscroll doesn't seem to work #2637

nilsga opened this issue May 11, 2013 · 3 comments

Comments

@nilsga
Copy link

nilsga commented May 11, 2013

I have a problem with autoscroll with ng-repeat and ng-include. I have this in a route template:

<div ng-repeat="item in items" ng-include="'partials/template'" autoscroll></div>

And then in the partial template

<div id="{{item.id}}"></div>

Then typing e.g. http://myhost/someurl#24 to go to the element with id 24 does not work. It does seem to work in very simple cases, but it seems to be a problem when I have expressions that might take some time to render. The reason seems to be that element.getElementById in the scroll function in the $AnchorScrollProvider returns null. Probably because elements from the partial aren't ready in the DOM yet.

I'm running my app with html5mode urls.

It might be related to the challenges described in issue #734

@nilsga
Copy link
Author

nilsga commented May 11, 2013

I'm using 1.0.6 btw

torgeir added a commit to torgeir/angular.js that referenced this issue May 11, 2013
This resolves an issue where the contents of an `ng-include` also contain an ng-include with autoscroll, like this `<div ng-repeat=".." ng-include=".." autoscroll="">`. 

In issue angular#2637 the element to scroll to by using `#some-anchor-name` in the url, e.g. `<a name="some-anchor-name"></a>`, is not present in the dom by the time `$anchorScroll()` is called from the ngIncludeDirective.
@nilsga
Copy link
Author

nilsga commented May 11, 2013

torgeir's pull request seems to fix the issue for me.

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

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

No branches or pull requests

2 participants