Boba Fett likes JS
Boba Fett likes JS

Reputation: 767

Marionette - Route pre-processing

I need some direction in the following situation I have to solve: I have a 'page' that have some fields that can be edit with 'save' button and with another button to 'navigate' to another place. If the user edit some fields and click on the 'navigate' button before saving the data, the application should show and message something like:

Confirm Navigation 
Button1 -> Leave this page Stay on this page
Button2 -> Stay on this page

I was think that I need some availability of pre-processing, before navigating to another place, Is there some availability in marionettejs before navigating in the AppRouter Or Router objects?, also I need to get some indication from the user, to which button he clicks.

Upvotes: 0

Views: 414

Answers (1)

Ming Chan
Ming Chan

Reputation: 1948

You should have events set up for the buttons

Backbone.Marionette.ItemView.extend({
    /* Removed other stuffs*/
    events: {
        'click #navigateBtn': function(e) {
            /* Do your preprocessing in here */
        }
    }, //events 
}

Upvotes: 1

Related Questions