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

fix($browser): prevent infinite digest if changing hash when there is no hashPrefix #12145

Merged
merged 0 commits into from
Jun 17, 2015

Conversation

petebacondarwin
Copy link
Contributor

The `window.location.hash' setter will strip of a single leading hash character
if it exists from the fragment before joining the fragment value to the href
with a new hash character.

This meant that if we want the fragment to lead with a hash character, we
must do window.location.hash = '##test' to ensure that the first hash
character in the fragment is not lost.

The $location.hash setter works differently and assumes that the value
passed is the the full fragment, i.e. it does not attempt to strip off a
single leading hash character.

Previously, if you called, $location.hash('#test'), the leading hash was
being stripped and the resulting url fragment did not contain this hash:
$location.hash(), then became 'test' rather than #test, which led to
an infinite digest.

Closes #10423

@petebacondarwin petebacondarwin added this to the 1.4.2 milestone Jun 17, 2015
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this pull request Jun 17, 2015
… no hashPrefix

The `window.location.hash' setter will strip of a single leading hash character
if it exists from the fragment  before joining the fragment value to the href
with a new hash character.

This meant that if we want the fragment to lead with a hash character, we
must do `window.location.hash = '##test'` to ensure that the first hash
character in the fragment is not lost.

The `$location.hash` setter works differently and assumes that the value
passed is the the full fragment, i.e. it does not attempt to strip off a
single leading hash character.

Previously, if you called, `$location.hash('#test')`, the leading hash was
being stripped and the resulting url fragment did not contain this hash:
`$location.hash()`, then became 'test' rather than `#test`, which led to
an infinite digest.

Closes angular#10423
Closes angular#12145
@petebacondarwin petebacondarwin merged commit f81ff3b into angular:master Jun 17, 2015
petebacondarwin added a commit that referenced this pull request Jun 17, 2015
… no hashPrefix

The `window.location.hash' setter will strip of a single leading hash character
if it exists from the fragment  before joining the fragment value to the href
with a new hash character.

This meant that if we want the fragment to lead with a hash character, we
must do `window.location.hash = '##test'` to ensure that the first hash
character in the fragment is not lost.

The `$location.hash` setter works differently and assumes that the value
passed is the the full fragment, i.e. it does not attempt to strip off a
single leading hash character.

Previously, if you called, `$location.hash('#test')`, the leading hash was
being stripped and the resulting url fragment did not contain this hash:
`$location.hash()`, then became 'test' rather than `#test`, which led to
an infinite digest.

Closes #10423
Closes #12145
netman92 pushed a commit to netman92/angular.js that referenced this pull request Aug 8, 2015
… no hashPrefix

The `window.location.hash' setter will strip of a single leading hash character
if it exists from the fragment  before joining the fragment value to the href
with a new hash character.

This meant that if we want the fragment to lead with a hash character, we
must do `window.location.hash = '##test'` to ensure that the first hash
character in the fragment is not lost.

The `$location.hash` setter works differently and assumes that the value
passed is the the full fragment, i.e. it does not attempt to strip off a
single leading hash character.

Previously, if you called, `$location.hash('#test')`, the leading hash was
being stripped and the resulting url fragment did not contain this hash:
`$location.hash()`, then became 'test' rather than `#test`, which led to
an infinite digest.

Closes angular#10423
Closes angular#12145
@petebacondarwin petebacondarwin deleted the issue-10423 branch November 24, 2016 09:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant