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

Function setBrowserUrlWithFallback

test/angular/1.4/angular.js:12502–12519  ·  view source on GitHub ↗
(url, replace, state)

Source from the content-addressed store, hash-verified

12500 var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
12501
12502 function setBrowserUrlWithFallback(url, replace, state) {
12503 var oldUrl = $location.url();
12504 var oldState = $location.$$state;
12505 try {
12506 $browser.url(url, replace, state);
12507
12508 // Make sure $location.state() returns referentially identical (not just deeply equal)
12509 // state object; this makes possible quick checking if the state changed in the digest
12510 // loop. Checking deep equality would be too expensive.
12511 $location.$$state = $browser.state();
12512 } catch (e) {
12513 // Restore old values if pushState fails
12514 $location.url(oldUrl);
12515 $location.$$state = oldState;
12516
12517 throw e;
12518 }
12519 }
12520
12521 $rootElement.on('click', function(event) {
12522 // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)

Callers 1

$LocationProviderFunction · 0.70

Calls 2

urlMethod · 0.80
stateMethod · 0.80

Tested by

no test coverage detected