使用$ http然后重定向AngularJS注销

Right so I have a little dilemma here :).

I'm working on a project that is built with angularjs and Laravel. Login is done with laravel which is out of AngularJs "scope", should I say.

So in Front End I do not see that page.

What I'm trying to do is use $http get method to get /logout (handled by laravel again). On success redirect user to /login.

So what I was thinking of doing is:

$rootScope.logout = function () {

        $http.get('/logout', function (response) {
            console.log('redirect');
            $window.location.href('/login');
        });
    };

But doesn't seem to work for some reason. Suggestions? /logout clears all sessions etc, which is out of my "jurisdiction" :)

Btw I'm also using UI-router.

查看全部
drecy22400
drecy22400
2016/09/29 09:20
  • laravel
  • php
  • angularjs
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复