[Solve] How to handle device back button action in ionic 2


Hi How can i handle Device back button navigation using ionic 2.


We can do it by overriding by defining event for back button

   platform.ready().then(() => {
          document.addEventListener('backbutton', () => {
              console.log('Back button tapped');
          }, false);


This used to work,
but since i updated to
"ionic-angular": "^2.0.0-beta.4

the event is thrown, but still the nativ event gets executed…
so on Android the app minimizes

I tried to use, but still it wont work

document.addEventListener('backbutton',this.backbuttonEventHandler =  (evt) => {
                         }, false);

After starting a new project an migrating all files i’ve got it to work again!