[英]Page keep reloading after redirecting in Angular 1.5
在我的應用中,我需要重定向無權輸入某些路由的用戶。 這是我的代碼的一部分:
$http.post(apiURL + '/all' , {
token: localStorage.getItem('token')
}).success(function (data) {
$rootScope.roomPictures = data;
}).error(function (error, status) {
if (status === 401) {
window.location.href = 'auth.html';
}
});
角度實際上重定向到auth.html,但隨后瀏覽器不斷刷新。 我在這里做錯了什么?
因此問題在於,在auth.html中,我具有與當前.html文件中相同的控制器。 創建新的控制器並將其添加到auth.html文件后,一切都會正常進行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.