Using ui-view to model the application, but it seems the history and back button would not work!

Hi,
I use AngularJS manner to route the application. I separated header, footer, content, and sidebar with ui-view as follow in index.html:

    <div ui-view="header"></div>
    <div ui-view="sidebar"></div>
    <div ui-view="content"></div>
    <div ui-view="footer"></div>
    
    <ion-nav-view ui-view></ion-nav-view>

and for ui-router: 

   $stateProvider

        .state('app', {
            url: "/",
            views : {
              'header' : {
                templateUrl : 'templates/common/header.tpl.html'
              },
              'sidebar' : {
                templateUrl : 'templates/common/sidebar.tpl.html'
              },
              'content': {
                templateUrl : 'templates/common/content.tpl.html'
              },
              'footer': {
                templateUrl : 'templates/common/footer.tpl.html'
              }

            }
            // controller: "homeCtrl"
        })

    $urlRouterProvider.otherwise('/');

all things are correct in chrome! But when i build it for android! the back hardware button cause that the program exit! It seems the ionicHistory would not work properly! the speed is really fast in the ui-view case. Is there any way to manage back hardware button. I found many issues in disabling back hardware button. but i want to manage it manually!!!

Best Regards,
Mostafa

You can disable it all together, using this piece of code:

.run(function($ionicPlatform) {
  // Disable BACK button on home
  $ionicPlatform.registerBackButtonAction(function(event) {
      // you don't need to put anything here
      console.log('Back button event detected');
  }, 101);
});

Notice number 101, it a priority. Everything above 100 will prevent back button from closing pages.

The priorities for the existing back button hooks are as follows: Return to previous view = 100 Close side menu = 150 Dismiss modal = 200 Close action sheet = 300 Dismiss popup = 400 Dismiss loading overlay = 500

Find more information here and here.

Thank you for your fast reply.

But you know, In each state, when i push back hardware button, the program will be exited. Does it related that i do not use

<ion-nav-view name="">

… in this case i can not manage header, footer, content in a view separately.

Best Regards,
Mostafa

+1, same issue here, $ionicHistory does not handle navigation in nested views unfortunately