Durandal docs使用激活剂很少。我正在尝试从nav
viewmodel手动触发home
视图模型的激活。我该怎么做?
shell.html
<section>
<!-- ko compose: {model: nav} --><!-- /ko -->
<section data-bind="router: {cacheViews: true}"></section>
</section>
home.js
define(function (require) {
var nav = require('viewmodels/nav'),
activate = function() {
//how to activate nav manually here?
//I am looking for something like:
//return activator.activate(nav);
//that would fire the transition of the *nav* module and would allow me to reuse
//the transition promise and delay activation of *home* module
};
return {activate: activate, nav: nav};
});
nav.js
define(function (require) {
var activate = function() {
//is this the correct way to disable auto-activation
//of viewmodel during composition?
return false;
};
return {activate: activate};
});