Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49103

ionicHistory not working properly

$
0
0

@hemant_Chaudhary wrote:

my states are as follows

.state('signin', {
      url: '/sign-in',
      templateUrl: 'views/sign-in.html',
      controller: 'SignInCtrl'
    })
    .state('tabs', {
      url: '/tab',
      controller: 'TabsCtrl',
      templateUrl: 'views/tabs.html'
    })
    .state('tabs.home', {
      url: '/home',
      views: {
        'home-tab': {
          templateUrl: 'views/home.html',
          controller: 'homeCtrl'
        }
      }
    })
    .state('tabs.profile', {
      url: '/profile',
      views: {
        'profile-tab': {
          templateUrl: 'views/profile.html',
            controller: 'profileCtrl'
        }
      }
    })
    .state('tabs.search', {
      url: '/search',
      views: {
        'search-tab': {
          controller:'searchCtrl',
          templateUrl: 'views/search.html'
        }
      }
    })

when i am on my tab.home page clicking logout button
here is its function

      $scope.logout=function(){
           // alert("in");
    		var hideSheet = $ionicActionSheet.show({
    			destructiveText: 'Logout',
    			titleText: 'Are you sure you want to logout?',
    			cancelText: 'Cancel',
    			cancel: function() {},
    			buttonClicked: function(index) {
                    alert("abs");
    				return true;
    			},
    			destructiveButtonClicked: function(){
    				$ionicLoading.show({
    				  template: 'Logging out...'
    				});
                usertype.resident=false;
                usertype.guard=false;

              $ionicHistory.clearHistory();
              $window.localStorage.clear();
              $ionicHistory.clearCache().then(function(){

            $state.go('signin');
            });
              $ionicLoading.hide();

              $ionicHistory.viewHistory().histories;
    			}
    		});
    	};`indent preformatted text by 4 spaces`

after logging out it's navigating to signin state, but when i click on back button it takes me on tab.home and on again when back button is clicked it closes the app. but the flow should be when i click on back button from signin state it should close the app instead of going to tab.home.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49103

Trending Articles



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