Commit a1d5e26f by Torkel Ödegaard

Added onbeforeunload check to unsaved changes warning feature

parent bdd2c9d0
...@@ -16,6 +16,12 @@ function (angular, _, config) { ...@@ -16,6 +16,12 @@ function (angular, _, config) {
var self = this; var self = this;
var modalScope = $rootScope.$new(); var modalScope = $rootScope.$new();
window.onbeforeunload = function () {
if (self.has_unsaved_changes()) {
return "There are unsaved changes to this dashboard";
}
};
this.init = function() { this.init = function() {
$rootScope.$on("$locationChangeStart", function(event, next) { $rootScope.$on("$locationChangeStart", function(event, next) {
if (self.has_unsaved_changes()) { if (self.has_unsaved_changes()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment