I took another look at my code and I hadn't specified deactivate in my viewmodel:
So ...
var vm = {
activate: activate
};
becomes ...
var vm = {
activate: activate,
deactivate: deactivate,
};
Question
I have my Durandal viewmodel for which the activation is working great
define(function (require) {
var vm = {
activate: activate
};
// =========
// snip snip
// =========
function activate() {
// Setup here
};
But on exit of the viewmodel I want to tear down something, by the docs there is a deactivate method but I can't get it work.
function deactivate(isClose) {
// Teardown here
};
Do Durandal viewmodels not have the deactivate method or am doing anything obviously wrong?
Solution
I took another look at my code and I hadn't specified deactivate in my viewmodel:
So ...
var vm = {
activate: activate
};
becomes ...
var vm = {
activate: activate,
deactivate: deactivate,
};