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

Preventing page reload when we try to reload the same page without empty hash at the end of URL #11160

Closed
gauravjhs opened this issue Feb 24, 2015 · 4 comments

Comments

@gauravjhs
Copy link

With latest fixes for (4b3a590, #10397, #10960), now if we click on a link to go to the same page, page is not getting reloaded. Instead a empty hash tag is getting appended at the end.

If I am on dummy.com/page1#/abc and I click on a link with href "page1" then angular is not reloading the page. I get new link as dummy.com/page1#

Even "otherwise" in $routeProvider is not working in this case.

@wesleycho
Copy link
Contributor

I cannot seem to reproduce this - http://plnkr.co/edit/a5FcyBQNVfJpjaDkHHRW?p=preview . Can you give a simple live reproduction of the issue?

@gauravjhs
Copy link
Author

I am not sure how to reproduce it on plunker but i'll try to explain it here.
Current URL: www.dummy.com/dashboard#/companies
I have a home (anchor) link with href="dashboard"
Earlier when user used to click on this, page used to reload but now when user clicks
New URL : www.dummy.com/dashboard#
without the page reload.

Hope this helps.

@thomasphan
Copy link

@wesleycho I reproduced the issue with a fork of your plunk

http://plnkr.co/edit/yjAsZqMMZ2Ic6EimfTcc?p=preview

The issue occurs when clicking "Link to self". Also, the issue is more obvious when you "Launch the preview in a separate window". Thanks!

@petebacondarwin petebacondarwin added this to the 1.4.x - jaracimrman-existence milestone Apr 27, 2015
@petebacondarwin petebacondarwin self-assigned this Apr 27, 2015
@petebacondarwin
Copy link
Contributor

The behaviour demonstrated in this issue is what we want to happen in the majority of cases. In other words, we do not want to trigger page reloads if we are just effectively changing the hash.

If you want to force a page reload you simply add target="_self" to the link: see http://plnkr.co/edit/DVm0Jq8hGcuqhclTW5Rj?p=preview

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

No branches or pull requests

4 participants