-
Notifications
You must be signed in to change notification settings - Fork 27.4k
$anchorScroll only working on second click #11749
Comments
The problem here is that by default there is no The second time you click the link then the path gets interpreted as http://run.plnkr.co/plunks/qw6Wtikz1hwgbGMHyqqY/#/Ipsum#Ipsum, where A workaround for this is to provide a app.config(function($locationProvider) {
$locationProvider.hashPrefix('!');
}); But I have a feeling that there is a bug in here somewhere... |
Just a sidenote: Note that since v1.4.0-rc.0, you can pass a hash explicitly to
but it doesn't update the @petebacondarwin, basically, when setting E.g.: // Now:
www.example.com/ + $location.hash('xyz') === www.example.com/#/xyz
// Proposed:
www.example.com/ + $location.hash('xyz') === www.example.com/#/#xyz |
Would the back button work with explicit?
|
I've been having issues also where I can get things to work with the anchorScroll but with an offset, it has this flashing problem. It's a bummer, I'm deep into this project and they use a lot of anchor tags and I'm using a fixed header for a phonegap biz app. I'm seriously considering dumping angular for the project just because I can't get around this issue. |
The explicit hash, only scrolls to the anchor. It doesn't change the URL, so it doesn't affect the history (so back button won't work). What issues do you have with the offset ? The flashing issues is related to |
I haven't worked up a plunker for the offset issue. I was just hoping that if this flashing issue worked with $location.hash then it would solve my other issue. And the issue for me is inconsistent. For some pages it works ok and for some not and I haven't figured out what it might be. One thing that made me wonder was finding someone talking about timing issues with when the content loads. Because the other thing is I'm loading in pages using the router into an ng-view. So I'm taking user content and building out just content pages and inserting them into ng-view and a lot of these pages have the anchor tags. There is something in that brew that's causing me these problems. Sorry I don't know more yet and thanks for asking. |
I think this problem is based around the crazy way the browser URL updates are captured and how we then try to massage them in HashBangLocation mode. There are quite a few other issues, which I suspect are related to this in some way: #11486, #11693, #11656, etc... We need to have a good hard look at this part of the location service. I will spend some time this afternoon on it. @gkalpak it would be great if you were online to bounce ideas off. |
I believe this is now fixed in master. See http://plnkr.co/edit/l8ICzAJEuJqL68mR71R1?p=preview |
Indeed from testing different commits, I believe it is f81ff3b, which fixed it. |
http://plnkr.co/qw6Wtikz1hwgbGMHyqqY
The text was updated successfully, but these errors were encountered: