2015-08-07 10 views
7

ios8'de çalışan açısal uygulamada yönlendirme, ios9'da bir [$ rootScope: infdig] hatası üretir. Hem ngRoute hem de ui.router'u denedim, ancak sonuç aynı.

Error: [$rootScope:infdig] http://errors.angularjs.org/1.4.3/$rootScope/infdig?p0=10&p1=%5B%5D 

Buna bir çözüm var mı?

+1

Bu bağlantıyı aç radar [https://openradar.appspot.com/22186109](https://openradar.appspot.com/22186109) bu yüzden henüz bir düzeltme görünmüyor. –

+2

Açısal github ile ilgili başka bir bağlantı [https://github.com/angular/angular.js/issues/12241](https://github.com/angular/angular.js/issues/12241] tekrar bir çözüm olarak henüz. –

cevap

1

Eğik v1.4.3

diff --git a/src/ng/browser.js b/src/ng/browser.js 
index 928de95..3b9957e 100644 
--- a/src/ng/browser.js 
+++ b/src/ng/browser.js 
@@ -87,7 +87,9 @@ function Browser(window, document, $log, $sniffer) { 
    var cachedState, lastHistoryState, 
     lastBrowserUrl = location.href, 
     baseElement = document.find('base'), 
-  reloadLocation = null; 
+  reloadLocation = null, 
+  pendingHref = null, 
+  pendingHrefTimer = null; 

    cacheState(); 
    lastHistoryState = cachedState; 
@@ -124,6 +126,18 @@ function Browser(window, document, $log, $sniffer) { 
    if (location !== window.location) location = window.location; 
    if (history !== window.history) history = window.history; 

+ // Schedule cleaning up pendingHref on the next run loop for setting URL. This is to handle 
+ // the case where the browser doesn't update the location.* properties immediately 
+ if (!pendingHrefTimer && pendingHref && url) { 
+  pendingHrefTimer = setTimeout(function() { 
+  if (location.href == pendingHref) { 
+   console.log('Actual href updated... setting pendingHref to null from setTimeout'); 
+   pendingHref = null; 
+  } 
+  pendingHrefTimer = null; 
+  }, 0); 
+ } 
+ 
    // setter 
    if (url) { 
     var sameState = lastHistoryState === state; 
@@ -147,6 +161,7 @@ function Browser(window, document, $log, $sniffer) { 
     // Do the assignment again so that those two variables are referentially identical. 
     lastHistoryState = cachedState; 
     } else { 
+  pendingHref = url; 
     if (!sameBase || reloadLocation) { 
      reloadLocation = url; 
     } 
@@ -161,10 +176,22 @@ function Browser(window, document, $log, $sniffer) { 
     return self; 
    // getter 
    } else { 
+  var href = location.href.replace(/%27/g, "'"); 
+  if (pendingHref) { 
+  //console.log('.. using pendingHref for url() return value'); 
+  href = pendingHref; 
+  } 
+ 
+  if (location.href == pendingHref) { 
+  console.log('Actual href updated... setting pendingHref to null in getter'); 
+  pendingHref = null; 
+  } 
+ 
+  //var href = location.href.replace(/%27/g,"'"); 
     // - reloadLocation is needed as browsers don't allow to read out 
     // the new location.href if a reload happened. 
     // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 
-  return reloadLocation || location.href.replace(/%27/g,"'"); 
+  return reloadLocation || href; 
    } 
    }; 

dayalı angular issue 12241 üzerinde Clever Coder gelen bu cevap Görünüşe ancak Açısal diğer sürümlerinde, sorunu çözer.