Ionic android back button registration after event


#1

Hello guyz,

I was able to register back button of android successfully in ionic app.js .run(),

$ionicPlatform.registerBackButtonAction(function (event) {
   //some code
    }, 100);

I am trying to make the language select page which is the first page and stores selected language in local storage after which home page comes in

How can I make sure that back button gets registered only when language was selected successfully.
problem is back button is being registered in .run function and it takes it back to home page if back button is pressed even before user selects any language.

In short I want to freeze the app until user selects the language and only then should the back button get registered