Display popup on navigating away from page
$window.onbeforeunload = function() { return "Are you sure you want to navigate away?"; };