How to disable android`s hardware backbutton fucntion on a particular view??
Try something like this in your run method:
$ionicPlatform.registerBackButtonAction(function () {
if ($state.current.name == "yourParticularViewStateName") {
return;
} else {
// handle back action, example:
navigator.app.backHistory();
}
}, 100);
3 Likes
Just a noob question, what would be the view state name? Where can I find this info?
Depends on your routing techniques. The default Ionic templates use $stateProvider
in app.js to define the states, its urls, its controllers and its views.
The state name would be tabs.timesheet?
.state(âtabs.timesheetâ, {
url: â/timesheetâ,
views: {
âtimesheet-tabâ: {
templateUrl: âtemplates/timesheet.htmlâ,
controller: âTimeSheetControllerâ
}
}
})
Yes, it is the string in the first parameter of .state
, in your case âtabs.timesheetâ.
1 Like