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

ngInclude compilation ignores autoscroll attribute #8848

Closed
@shaungrady

Description

@shaungrady

$AnchorScroll is instantiated when ngInclude is compiled. Instantiation sets $AnchorScroll's watcher and calls the listener, scrolling the window to the top:
https://github.com/angular/angular.js/blob/master/src/ng/anchorScroll.js#L96

It seems that checking for $location.hash inequality in autoScrollWatchAction() before calling scroll() would fix this issue, though I'm not familiar enough with $AnchorScroll to know if that would have wider implications.

I understand that, technically, the instantiation of $AnchorScroll is unrelated to ngIncude's autoscroll attribute, but it certainly seems counterintuitive that this current behavior exists.

Example Plunkr:
http://plnkr.co/edit/XMuTqFmvKB7LzRyuzLSs?p=preview

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions