Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Logout and return to welcome view. ionicHistory

$
0
0

@Aceconhielo wrote:

Hello,

Im trying to create a controller that clear the cache of navigation in the app for make a Logout button.

My idea is cleaning the Session ID when I tap the Logout Button so I can go the Welcome View with the app "closed".

Im trying to use $ionicHistory for this:

.controller('LogoutCtrl', ['$scope', '$state', '$ionicHistory', function($scope,$state,$ionicHistory) {
  $scope.logout = function(){
      $ionicHistory.clearCache().then(function() {
        //now you can clear history or goto another state if you need
        $ionicHistory.clearHistory();
        $ionicHistory.nextViewOptions({ disableBack: true, historyRoot: true });
        $state.go('welcome');
      })
    };
}])

But when I tap the button, It does nothing.

  `<button class="button button-block button-dark" ng-click="logout()" >Logout</button>`

Any ideas what is the problem?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>