Prevent hardware back button click when loading controller is showing


#1

Hi,

I am using a loading controller during a http call. In android when I press hardware back button the page navigates back but loading controller is still displayed. What I want to disable hardware back button when loading controller is displaying.

Ionic info;
Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.1 Build version 8E1000a


#2

i have the same issue let me know when you find the solution. thanks :slight_smile:


#3

Not a good solution but I register back button action before calling any http call using registerBackButtonAction function & deregister it in http response or error.

registerBackButtonAction(){
    this.unregBackCall = this.platform.registerBackButtonAction(() => {

    }, 100);
  }

  removebackbtnaction(){
    this.unregBackCall && this.unregBackCall();
  }

Ionic team should add disabling back button action while loading controller is showing.

Thanks