Accessing child router functions from the shell

9 views
Skip to first unread message

interbeing

unread,
Jul 24, 2016, 1:52:42 PM7/24/16
to DurandalJS
In router.map, I have the following:

{ route: '01_02_003*details', moduleId: 'viewmodels/chapter2/01_02_003', title: 'Chapter 2 Page 3', nav: true },

In shell.js I have the following. Everything with the child router works, but I want the Next and Back buttons in shell.js to be able to duplicate the functionality of the inner Next and Back buttons inside of 1.js, 2.js, 3.js, 4.js, and 5.js, which are the child router viewmodels. Is there any way to reference the child router viewmodel functions from shell.js? From the child router I can just call $shell.functionNameHere or $shell.observableNameHere, but the reverse doesn't seem to work.

createChapter2Router: function() {
if (!$shell.chapter2Router) {
$shell.chapter2Router = router.createChildRouter()
.makeRelative({
moduleId: 'viewmodels/chapter2/childRouter',
fromParent: true
}).map([
{ route: ['', '1'], moduleId: '1', title: 'Chapter 2 - Child Router', type: 'intro', nav: true },
{ route: ['2'], moduleId: '2', title: 'Chapter 2 - Child Router', type: 'intro', nav: true },
{ route: ['3'], moduleId: '3', title: 'Chapter 2 - Child Router', type: 'intro', nav: true },
{ route: ['4'], moduleId: '4', title: 'Chapter 2 - Child Router', type: 'intro', nav: true },
{ route: ['5'], moduleId: '5', title: 'Chapter 2 - Child Router', type: 'intro', nav: true },
]).buildNavigationModel();
}
},

Reply all
Reply to author
Forward
0 new messages