How update history stack after state change in ionic 1

I was try to erase and push new page in history to prevent view a page when user press back button or through header back navigation arrow.

My Navigation flow is :

Home -> Quiz -> Quiz list -> Quiz Info -> Quiz Test -> Quiz Complete

User click Quiz form sidemenu its open Quiz List State(app.quiz) then click on any of one will open Quiz info State (app.quizinfo) page, on this page user click on Start Quiz Button form this page will open Quiz Test State (app.quizexe) page once user finish will open Quiz Complete State (app.quizcomplete) page. Now if user press back button or tap on nav arrow on header bar it will back to Quiz Test Page. I wanted to show Quiz Info page instead.


app.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state(‘app.quiz’, {
url: ‘/quiz’,
views: {
‘menuContent’: {
templateUrl: ‘templates/quiz/quizlists.html’,
controller: ‘quizListsCtrl’
}
}
})
.state(‘app.quizinfo’, {
url: ‘/quiz/info’,
views: {
‘menuContent’: {
templateUrl: ‘templates/quiz/quizinfo.html’,
controller: ‘quizInfoCtrl’
}
},
params: {
quizid: null
}
})
.state(‘app.quizexe’, {
url: ‘/quiz/exe’,
views: {
‘menuContent’: {
templateUrl: ‘templates/quiz/quizexe.html’,
controller: ‘quizExeCtrl’
}
},
params: {
quizid: null
}
})
.state(‘app.quizfinish’, {
url: ‘/quiz/finished’,
views: {
‘menuContent’: {
templateUrl: ‘templates/quiz/quizfinish.html’,
controller: ‘quizFinishCtrl’
}
}
});
$urlRouterProvider.otherwise(’/app/home’);

when your app enters ->Quiz Complete
you can trigger $ionicHistory.clearHistory()
somthing like this
$ionicHistory.nextViewOptions({ disableBack: true }); $ionicHistory.clearHistory(); $ionicHistory.clearCache();

I had added as you suggest as bellow - but when I press back nav arrow form header its not working.

.controller('ExamFinishCtrl', function ($scope, $ionicHistory, $stateParams) {

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

  })

Thats just to clear the history.
to navigate back to a page then clear the history with
$ionicHistory.goBack(-1);
-1 being the amount of pages to navigate back to.
or push a new page then clear history