Problem with Back button

Hello
Is there any solution in angularjs to associate a function by clicking the physical button to go back? I have the problem of when I click the button, the application closes and does not go back. Any suggestion?

Yes you can.
registerBackButtonAction(fn, priority)
https://ionicframework.com/docs/api/platform/Platform/

Thank you, that worked. But now I have another “problem”, I did not want to disable the button on all pages. I wanted to leave the main page with the possibility of going back, closing the application

You could add a condition in your override where you check it.

Yes, but if I enter a page where the back button is locked, the rest of the application is always with the button locked. That is when it blocks once, it no longer unlocks. Thanks

You just have to delete it when you leave by using ngdestroy
check this topic, it’s probably not your ionic version but it’s the same :

Thank you, it worked