From e8f9dd734502c4cf59b5a8533a28c620b8a3e0ca Mon Sep 17 00:00:00 2001 From: Pavel Vasek Date: Fri, 24 May 2013 18:23:55 +0200 Subject: [PATCH] If you use html5mode on IE9, IE8 it fails with 10 $digest() iterations reached. There was an issue with location.replace method isn't changing the location.href immediately. --- src/ng/browser.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/ng/browser.js b/src/ng/browser.js index fa050d54511f..eafb8aa70991 100644 --- a/src/ng/browser.js +++ b/src/ng/browser.js @@ -123,8 +123,9 @@ function Browser(window, document, $log, $sniffer) { // URL API ////////////////////////////////////////////////////////////// - var lastBrowserUrl = location.href, - baseElement = document.find('base'); + var lastBrowserUrl = location.href, + baseElement = document.find('base'), + replacedUrl = null; /** * @name ng.$browser#url @@ -159,14 +160,20 @@ function Browser(window, document, $log, $sniffer) { baseElement.attr('href', baseElement.attr('href')); } } else { - if (replace) location.replace(url); - else location.href = url; + if (replace) { + location.replace(url); + replacedUrl = url; + } else { + location.href = url; + replacedUrl = null; + } } return self; // getter } else { + // the replacedUrl is a workaround for an issue with location.replace method isn't changing the location.href immediately // the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 - return location.href.replace(/%27/g,"'"); + return replacedUrl || location.href.replace(/%27/g,"'"); } };