从历史记录中删除的页面,所以"返回]将正常工作 [英] Remove page from history, so "back" will work properly

查看:119
本文介绍了从历史记录中删除的页面,所以"返回]将正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序,您需要登录到获得在其它页面。

I have my app that you need to login to get in to the other pages.

所以第一个页面登录,它会检查您是否已经登录,如果是这样,你将被重定向到主页应用程序,如果没有它会告诉你的登录页面。

so the first page is "login" and it checks if you are already logged, if so you will be redirected to the main page app, if not it will show you the login page.

现在的问题是,当用户登录页面区域内,和他点击回到他将获得的登录页面,比重定向回主页,因为他在已经被记录下来。

now the problem is when the user is inside the logged page area, and he clicks back he will get to the "login" page and than redirected back to the main page, as he is logged in already.

所以,他是停留在一个无限循环。

So he is stuck in an infinite loop.

我怎样才能从历史记录中删除登录页面。

how can I remove the login page from the history.

就像

推荐答案

下面是解决方案!

简单的使用:

  $ionicHistory.nextViewOptions({
     disableBack: true
  });

例如,对于登录功能:

example for login function:

$scope.login = function () {

Security.login($scope.cred.email, $scope.cred.password)
    .success(function(data) {
        Security.setUser(data.data[0]);
        $ionicHistory.nextViewOptions({
            disableBack: true
        });
        $state.go('posts', {}, {location: "replace", reload: true});
    }).error(function(data) {
        $scope.showAlert();
    });
};

这篇关于从历史记录中删除的页面,所以"返回]将正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆