繁体   English   中英

在Angular 1.5中重定向后页面继续重新加载

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM