MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / setBrowserUrlWithFallback

Function setBrowserUrlWithFallback

lib/test/angular/1.4.3/angular.js:12031–12048  ·  view source on GitHub ↗
(url, replace, state)

Source from the content-addressed store, hash-verified

12029 var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
12030
12031 function setBrowserUrlWithFallback(url, replace, state) {
12032 var oldUrl = $location.url();
12033 var oldState = $location.$$state;
12034 try {
12035 $browser.url(url, replace, state);
12036
12037 // Make sure $location.state() returns referentially identical (not just deeply equal)
12038 // state object; this makes possible quick checking if the state changed in the digest
12039 // loop. Checking deep equality would be too expensive.
12040 $location.$$state = $browser.state();
12041 } catch (e) {
12042 // Restore old values if pushState fails
12043 $location.url(oldUrl);
12044 $location.$$state = oldState;
12045
12046 throw e;
12047 }
12048 }
12049
12050 $rootElement.on('click', function(event) {
12051 // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)

Callers 1

$LocationProviderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected