Reputation: 966
I'm trying to make child router of a child router in Durandal.js, but getting random dumb errors (for example 404 etc.). Is it Durandal's issue (I mean if it has not third-level subrouting support) or it's maybe my code problem?
Thanks
Anyways, I'm going to include my code here:
returning shell
return {
router: router,
activate: function () {
return router.map([
{
route: ['', 'Main'],
moduleId: 'Main/index',
nav: false
},
{
route: 'Main*details',
moduleId: 'Main/index',
hash: '#/Main/',
title: 'Main',
nav: false
}
]).buildNavigationModel()
.activate();
}
};
returning 2nd level child
var mainRouter = router.createChildRouter()
.makeRelative({
moduleId: 'Main',
fromParent: true
}).map([
{
route: ['', 'Dashboard'],
moduleId: 'Dashboard/index',
nav: false
},
{
route: 'Dashboard*details',
moduleId: 'Dashboard/index',
hash: '#/Main/Dashboard',
title: 'Dashboard',
nav: true
}
]).buildNavigationModel();
return {
router: mainRouter
}
returning 3rd level child
var dashboardRouter = router.createChildRouter()
.makeRelative({
moduleId:'Dashboard',
fromParent: true
}).map([
{
route: ['', 'Product'],
moduleId: 'Product/index',
hash: '#/Main/Dashboard/Product',
title: 'Product',
nav: true
}
]).buildNavigationModel();
return {
router: dashboardRouter
}
Upvotes: 0
Views: 298
Reputation: 25
hah... This is quite simple:
(var dashboardRouter = router.createChildRouter()
.makeRelative({
moduleId:'Dashboard',
fromParent: true
}).map([
{
route: ['', 'Product'],
moduleId: 'Product/index',
hash: '#/Main/Dashboard/Product',
title: 'Product',
nav: true
}
]).buildNavigationModel();
return {
router: dashboardRouter
}).makeRelative({
moduleId: 'Main',
fromParent: true
}).map([
{
route: ['', 'Dashboard'],
moduleId: 'Dashboard/index',
nav: false
},
{
route: 'Dashboard*details',
moduleId: 'Dashboard/index',
hash: '#/Main/Dashboard',
title: 'დეშბორდი',
tab: "dashboard",
nav: true
}
]).buildNavigationModel();
return {
router: mainRouter
}
Upvotes: -1
Reputation: 3999
I believe it's currently a bug in child routers that are at the 3rd level or below. We have this tracked as an issue and are working on a solution. I apologize for the inconvenience.
Upvotes: 2