1.4 +新路由器:默认组件?

时间:2015-09-16 18:07:26

标签: angularjs angularjs-routing angularjs-new-router

使用新路由器和Angular 1.4,是否可以为特定视口定义默认组件?例如,我的侧面和顶部导航是组件,目前我必须定义这样的每条路线:

    $router.config([
        {
            path: '/',
            components: {
                'topbar': 'topbar',
                'sidebar': 'sidebar',
                'default': 'dashboard'
            }
        },
        {
            path: '/notice/new',
            components: {
                'topbar': 'topbar',
                'sidebar': 'sidebar',
                'default': 'notice.new'
            }
        }
    ]);

正如您所看到的,我必须在每条路线中定义顶杆和侧边栏组件,即使它们完全相同。有没有办法告诉新路由器“始终将此组件用于此视口,除非被特定路由覆盖”?

0 个答案:

没有答案