MCPcopy
hub / github.com/angular-ui/ui-router / setBrowserUrlWithFallback

Function setBrowserUrlWithFallback

test/angular/1.6/angular.js:14634–14651  ·  view source on GitHub ↗
(url, replace, state)

Source from the content-addressed store, hash-verified

14632 var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
14633
14634 function setBrowserUrlWithFallback(url, replace, state) {
14635 var oldUrl = $location.url();
14636 var oldState = $location.$$state;
14637 try {
14638 $browser.url(url, replace, state);
14639
14640 // Make sure $location.state() returns referentially identical (not just deeply equal)
14641 // state object; this makes possible quick checking if the state changed in the digest
14642 // loop. Checking deep equality would be too expensive.
14643 $location.$$state = $browser.state();
14644 } catch (e) {
14645 // Restore old values if pushState fails
14646 $location.url(oldUrl);
14647 $location.$$state = oldState;
14648
14649 throw e;
14650 }
14651 }
14652
14653 $rootElement.on('click', function(event) {
14654 var rewriteLinks = html5Mode.rewriteLinks;

Callers 1

$LocationProviderFunction · 0.70

Calls 2

urlMethod · 0.80
stateMethod · 0.80

Tested by

no test coverage detected