Backbutton in slides

I have a slider in the main page of my app, and I want the back button do not exit the app but moves to the previous slide.

I have read this doc: http://ionicframework.com/docs/v2/api/platform/Platform/#backButton, so I guess I do not need to subscribe to the event in this way anymore:

document.addEventListener("backButton", () => {
  this.slides.slidePrevious();
}, false);

What is the right way to subscribe to the backButton event now?

Thank you

You could combine the Events API

events.subscribe('backButton', () => {
  console.log('backbutton is pressed);
});

Haven’t tested it out though…

Does the Platform class publish the event? I cannot find where. I just can see this line:

backButton: EventEmitter<any> = new EventEmitter();

In line 323 here: https://github.com/driftyco/ionic/blob/2.0/ionic/platform/platform.ts

So if the event it not published, can I subscribe to it anyway?

Sorry, I must be doing it wrong, but I am not able to listen to that event.

Thank you

@mhartington, Maybe it is not possible to do what I was trying. Look at this issue:
https://github.com/driftyco/ionic/issues/6282

It is a pitty, because when you are navigating in a slider and you press the back button, what you are usually expecting is moving to the previous slide, not closing the app.

Thank you anyway.

I’m trying to do the same thing. I’m trying to use a multi step form kind of a process and the back button is just wrong for the slider when used this way.

I may end up just calling the same page/component with an updated parameter and push it to the nav stack to get the same basic concept. I just wish that the navbar didn’t animate while the content did. Plus having the other options for the swiping/sliding would be nice.