Tutorialsplane

Hide back button in ionic AngularJs


Hide back button in ionic AngularJs : Sometimes we need to hide the back button on some pages. We can use $ionicNavBarDelegate service and showBackButton() function to show and hide the back button.


Hide back button in ionic AngularJs

You disable the back button in ionic as below –

Hide back button in ionic AngularJs Example

.controller('MainCtrl', function($scope, $location, $ionicNavBarDelegate) {
   var path = $location.path();
   if (path.indexOf('edit') != -1){
     $ionicNavBarDelegate.showBackButton(false);
	 }
   else{
     $ionicNavBarDelegate.showBackButton(true);
	 }
})

The above example will hide the back button where the page index of ‘edit’ is not equal to -1 ie it will hide the back button except the edit page. So you can add other condition to show and hide the back button.

Ionic FAQ