chaplinjs / chaplin

HTML5 application architecture using Backbone.js
http://chaplinjs.org
Other
2.85k stars 232 forks source link

How I can "catch" redirect event to show prompt/confirm modal? #828

Open alekbarszczewski opened 10 years ago

alekbarszczewski commented 10 years ago

In almost every view in my app user may edit some content and then click "save" to sync edited data to server. If user edits some data, does not save them and redirects to another page/view/controller via HTML link or Chaplin.utils.redirectTo method, then I would like to show a modal thats says something like "Hey you didn't save your data - are you sure you want to leave this page?".

Where and how I can catch "redirect" event and prevent it when neccessery?