This repository was archived by the owner on May 28, 2022. It is now read-only.
Fix back button functionality in AngularJS 1.6+. #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes to Angular 1.6, specifically:
angular/angular.js@2b360bf
Resulted in angular detecting
window.history.pushState
changes.As a result, the stackables state that is pushed when opening
a stackable was detected by angular on the next digest cycle,
resulting in angular issuing a route change event. This event
cannot be canceled using
preventDefault
as angular's$browser
will attempt to revert to the previous history when this happens,
thereby mangling the history. Detecting when to cancel the route
change may also be problematic as the necessary information to
determine whether it's a valid route change may not be available.
Instead, a horrible hack was written to override
onUrlChange
listeners so that they will not detect any changes to history
state when a stackable is open or when all stackables have been
closed and we are reverting back to the previous history state.
This change also makes it such that links to the same route that
a stackable was opened from cannot be used in the stackable, but
this is generally considered an anti-pattern, defeating the
purpose of using a stackable to preserve the state on the route
it was launched from. So, don't use links like that.