Page should not be refreshed during history back

Hi everyone,

               I need page should not be refreshed during back from a page(history back) and it goes to the same position while i navigate from

Quick help would be appreciated


where can i use this

angular.module(‘ionicApp’, [‘ionic’])

.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {


hi thesourav that’s not working form me when i back to previous page it all refreshes the page

Hi, muraleecse

I just want to ask you, when you came back (click on back button) ,the page will refresh or not.
->if you want to refresh then use

    $scope.$on('$ionicView.enter', function (event, data) {
                  //call your function here 

-> you don’t want to refresh then, just send here your function where you want to store data to $scope

i doesnt want to refresh the page


ok just send here function so, i will check it why it was refresh

$scope.chefList =;(array lists)

sessionStorage.setItem(“SessionMessage”, JSON.stringify(;setting lists in session storage…

after history back

if (window.localStorage.getItem(‘back’) == 1) {
//for normal listing
$scope.errMsgLbl = { display: ‘none’ };
$scope.chefList = JSON.parse(sessionStorage.getItem(“SessionMessage”));
} else {



this is i am using for history back

Hi @muraleecse,

I think, for history back you should use a service provided by ionic instead of $window.history.back();

For example,

$scope.goBack = function() {

You just need to inject $inonicHistory service in your controller and put the above code in your controller and call goBack() function from the header back button.

In this way your page may also not get refreshed.

Hope this will help you.

thank you addwebsolution for your reply

I will try it

Ok and if it helps you then you can always like the answer by clicking heart button.

The smallest piece of efforts is always appreciated! :slight_smile:

yes sure
i will do it

it throws Unknown provider: $ionicHistoryProvider

Have you injected $ionicHistory in your controller?

yes after i added in controller only it throws error

this is my code ($ionicPlatform, $location, $ionicPopup, $rootScope, $state, $ionicSideMenuDelegate, $window, $ionicHistory) {


This is your function which will call at the time of initialization of the application.

Please add $ionicHistory in the controller fuction.

appp.controller(‘backcontroller’, [’$ionicHistory’, function ($ionicHistory) {

like this right?