-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($location/$browser): prevent infinite digests on empty hash changes #9903
Conversation
function getHash(url) { | ||
var index = url.indexOf('#'); | ||
return index===-1 ? '' : url.substr(index+1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that this function should be inside browser.js
but there were other helper function here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing spaces around ===
and +
😃
this could use some tests --- I think it's probably a suitable place to use the new e2e test harness (since it depends on being able to change location --- you should be able to try changing to |
a01e9af
to
382efe4
Compare
The url is the same whether or not there is an empty `#` marker at the end. This prevents unwanted digest turns. Closes angular#9635
382efe4
to
c42e887
Compare
@caitp - yes you are right. I was struggling to test this in an non-artificial way. I'll give it a go tomorrow. |
at a glance it looks okay, but $location is a bit complicated, so I want to see it work before I say lgtm |
Fixes #9635