angularjs - Remove page from history, so "back" will work properly -
i have app need login in other pages.
so first page "login" , checks if logged, if redirected main page app, if not show login page.
now problem when user within logged page area, , clicks "login" page , redirected main page, logged in already.
so stuck in infinite loop.
how can remove login page history.
just in android "android remove activity history stack"
here solution!
simply use:
$ionichistory.nextviewoptions({ disableback: true }); example 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(); }); }; angularjs ionic-framework angular-ui-router
No comments:
Post a Comment