Durandal child router updating bindings only once -
the router have created builds navigation model, it's missing update bindings need updated each time page loaded within childrouter
(app.pagetitle
, app.pagedescription
).
is there way how map these updates durandal's lifecycle, activate
event?
define([ 'durandal/app', 'plugins/router', 'knockout', 'app' ], function(app, router, ko, app) { console.log("content start"); var childrouter = router.createchildrouter().makerelative({ moduleid : 'app/content/pages', fromparent : true }).map([ { route : [ '', 'grid' ], moduleid : 'grid/index' }, { route : 'details/:id', moduleid : 'details/index' }, { route : 'details/tabs/base', moduleid : 'details/tabs/base' } ]).buildnavigationmodel(); console.log("cms title start"); app.pagetitle(app.i18n('app:modules.content.title')); app.pagedescription(app.i18n('app:modules.content.subtitle')); console.log("cms title stop"); return { router : childrouter }; });
the simplest solution works adding activate
function , returning it. durandal call everytime page childrouter
navigation model requested.
define([ 'durandal/app', 'plugins/router', 'knockout', 'app' ], function(app, router, ko, app) { console.log("content start"); var childrouter = router.createchildrouter().makerelative({ moduleid : 'app/content/pages', fromparent : true }).map([ { route : [ '', 'grid' ], moduleid : 'grid/index' }, { route : 'details/:id', moduleid : 'details/index' }, { route : 'details/tabs/base', moduleid : 'details/tabs/base' } ]).buildnavigationmodel(); function activate() { console.log("cms title start"); app.pagetitle(app.i18n('app:modules.content.title')); app.pagedescription(app.i18n('app:modules.content.subtitle')); console.log("cms title stop"); } return { activate : activate, router : childrouter }; });
Comments
Post a Comment