0

URLバーに入力すると:

http://localhost:28905/#knockout-samples/

左側に hello world ルートがあります。クリックすると、URL バーが次のように変わります。http://localhost:28905/#knockout-samples/helloWorld

http://localhost:28905/#knockout-samples/1.)最初に子ルートを使用してルートをすぐに読み込むにはどうすればよいですか?ノックアウト サンプルを読み込むと、

this: http://localhost:28905/#knockout-samples/helloWorld and not 
this: http://localhost:28905/#knockout-samples/

durandaljs サンプルから:

var childRouter = router.createChildRouter().makeRelative({ moduleId: 'ko', fromParent: true }).map([
            { route: '',                moduleId: 'helloWorld/index',       title: 'Hello World',           type: 'intro' },
            { route: 'helloWorld',      moduleId: 'helloWorld/index',       title: 'Hello World',           type: 'intro',      nav: true},
            { route: 'clickCounter',    moduleId: 'clickCounter/index',     title: 'Click Counter',         type: 'intro',      nav: true},
            { route: 'simpleList',      moduleId: 'simpleList/index',       title: 'Simple List',           type: 'intro',      nav: true },
            { route: 'betterList',      moduleId: 'betterList/index',       title: 'Better List',           type: 'intro',      nav: true},
            { route: 'controlTypes',    moduleId: 'controlTypes/index',     title: 'Control Types',         type: 'intro',      nav: true },
            { route: 'collections',     moduleId: 'collections/index',      title: 'Collection',            type: 'intro' ,     nav: true },
            { route: 'pagedGrid',       moduleId: 'pagedGrid/index',        title: 'Paged Grid',            type: 'intro',      nav: true },
            { route: 'animatedTrans',   moduleId: 'animatedTrans/index',    title: 'Animated Transition',   type: 'intro',      nav: true },
            { route: 'contactsEditor',  moduleId: 'contactsEditor/index',   title: 'Contacts Editor',       type: 'detailed',   nav: true },
            { route: 'gridEditor',      moduleId: 'gridEditor/index',       title: 'Grid Editor',           type: 'detailed',   nav: true },
            { route: 'shoppingCart',    moduleId: 'shoppingCart/index',     title: 'Shopping Cart',         type: 'detailed',   nav: true },
            { route: 'twitterClient',   moduleId: 'twitterClient/index',    title: 'Twitter Client',        type: 'detailed',   nav: true}
        ]).buildNavigationModel();
4

1 に答える 1