Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Back button always firing "modal dismiss" instead of "sidemenu close" or "return to previous view"?

$
0
0

@andmar8 wrote:

I have been following the docs here: http://ionicframework.com/docs/api/service/$ionicPlatform/

I have overridden the "Return to previous view = 100" with a function like so

var deregisterBackButtonOverride = $ionicPlatform.registerBackButtonAction(function(){
    /* do stuff */
},101);

If I then override the "Dismiss modal = 200" with a function:

var deregisterBackButtonModalOverride = $ionicPlatform.registerBackButtonAction(function(){
    /* do stuff */
},201);

The closure of the sidemenu and returning to a previous view using the back button stops functioning entirely (???), i.e. trying to dismiss a modal "or" trying to close the sidemenu, or trying to go back a view results in the priority 201 function being called.

In the docs it says

Only one action will execute when the back button is clicked, so this method decides which of the registered back button actions has the highest priority

So my presumption is if you override dismiss modal, then that function should NOT be being called when no modal is open as ionic should decide that the highest priority should be either closing a sidemenu or going back (depending on the situation), I don't understand why (given no modal being open) that ionic is firing a priority 201?

EDIT: I've also tried overriding the existing priorities (100, 200 instead of 101, 201)

This is on android (cordova 5.4.1, ionic 1.2.4)

FURTHER EDIT: The way this actually seems to work, is not what I expect, basically whatever priority number you assign you basically override all functions up to that priority.

So if you assign 200 you need to write your own handlers for all functions up to that priority (WTF?)

This CAN'T be what was intended?!!?!?!?

Put another way, if you override at priority 200, in the handler you override with you have to deal with returning to a previous view AND closing a side menu AND dismissing modals. Surely, an override at 200 should ONLY override the modal dismiss code and code at 100 and 150 should remain default unless overridden?????

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>