2016-09-23 35 views
0

$範圍。$上( 「$ locationChangeStart」 功能(事件,接下來,電流){

 if (!$rootScope.isPopupOpen) { 

      if ($rootScope.isUrlLoad) { 

       window.location.reload(); 

      } 
     } 

     $rootScope.isUrlLoad = true; 

    }); 

In other browser,i have no problem for loading..But in firefox it continuously loading.can anyone please suggest me? 

回答

1

您的問題,它可能涉及到的事實$locationChangeStart它被稱爲連第一次頁面加載

簡單地擺脫這個問題的一個標誌。

var firstTime = true; 
$scope.$on("$locationChangeStart", function (event, next, current) { 

    if(firstTime){ 
     firstTime = false; 
     event.preventDefault(); 
     return; 
    } 

    if (!$rootScope.isPopupOpen) { 

     if ($rootScope.isUrlLoad) { 

      window.location.reload(); 

     } 
    } 
    $rootScope.isUrlLoad = true; 
}); 
+0

感謝您的建議 –

相關問題