want to go to home page when clicked on back button in mobile?

I am developing a mobile app on ionic framework. It has a side menu with subcategories. Whenever I go to the subcategory more than once and click on the back button in android mobile, it retraces whole of the states it went through which I don't want.

.state('eventmenu', {
  url: "/event",
  abstract: true,
  templateUrl: "templates/event-menu.html"
})



.state('eventmenu.home', {
  url: "/home",
  views: {
    'menuContent' :{
      templateUrl: "templates/home.html",
      controller: "HomeCtrl"
    }
  }
})


.state('categorymenu', {
  url: "/category",
  abstract: true,
  templateUrl: "templates/event-menu.html"
})

.state('categorymenu.compound', {
  url: "/compound",
  views: {
    'menuContent' :{
      templateUrl: "templates/categories.html",
      controller: "CategoriesCtrl"
    }
  }
})

.state('categorymenu.research', {
  url: "/research",
  views: {
    'menuContent' :{
      templateUrl: "templates/categories.html",
      controller: "CategoriesCtrl"
    }
  }
})



.state('categorymenu.product', {
  url: "/product",
  views: {
    'menuContent' :{
      templateUrl: "templates/product.html",
      controller: "CategoriesCtrl"
    }
  }
})


$urlRouterProvider.otherwise("/event/home");
})

I want the back button to redirect user to the home page. Here categorymenu.compound and categorymenu.research are the contents of sidemenu, which has got many subcategories that would redirect to categorymenu.product page.

redefine backbutton function on each controller loading, you can use :$ionicPlatform.registerBackButtonAction(function(){$state.go('targetView')}, priority, [actionId])

but you need clear cache when you reload views (for redefine backbutton each time and have SEVERAL possible return).

you can add param in each redirect :

$state.go('targetView',{cache: false});

or add param in state description

.state('eventmenu.home', {
  cache: false
  url: "/home",
  views: {
    'menuContent' :{
      templateUrl: "templates/home.html",
      controller: "HomeCtrl"
    }
  }
})