How to fire deactivate event when parent route changing. For instance in 'HTML Samples', when Master-Detail page is active, change view to another one. How to force dialog "Do you want to leave...." here?
Thanks Vladimir.
UPD:
Code from HTML Samples with replaced dialogs
project.js
define(['durandal/system', 'durandal/app'], function (system, app) {
var ctor = function (name, description) {
this.name = name;
this.description = description;
};
ctor.prototype.canActivate = function () {
return true; //!!! CHANGED!!!
};
ctor.prototype.activate = function () {
system.log('Model Activating', this);
};
ctor.prototype.canDeactivate = function () {
return false; //!!! CHANGED!!!
};
ctor.prototype.deactivate = function () {
system.log('Model Deactivating', this);
};
return ctor;
});
Now you can not change detail view using select control. But easily can change whole module via navigation panel.