Mobile: Plugin development: How to add confirm to button back.

Mobile: Plugin development: How to add confirm to button back.

by Minh Hùng -
Number of replies: 1

Hi,

My plugin I am working have a text input, textarea for user input content.

When user type some thing and try to leave page by Press button back at the top left, It displays a confirm message like 

"Changes you made may not be saved. Are you sure you want to leave this page ?".

If user click Ok, the app will display the Course Homepage, press cancel, it will stay on current activity.

I  have search around and I found out that, the Moodle mobile app has ionViewCanLeave which can handle this case.

The Moodle mobile plugin currently use the pure javascript to develop. Is there any way to fire event viewCanLeave in javascript

Or is there other way to handle this ?

Please help me.

Many thanks.

(For any one need more detail about the event ionic can reference here https://blog.ionicframework.com/navigating-lifecycle-events/)


Average of ratings: -