功能模块的路由层次结构

时间:2018-06-27 21:30:55

标签: angular

我有2个功能模块。 目录搜索和窗口小部件模块。 它们具有自己的独立路由,并且都具有空的默认路由。

目录搜索模块的路由如下。

const directorySearchRoutes: Routes = [
{
    path: "",
    children: [
        { path: '', component: DirectorySearchComponent }            
    ]
}

];

小部件模块的路由如下。

const widgetsRoutes: Routes = [
{
    path: "",
    children: [
        { path: '', component: WidgetDashboardComponent }            
    ]
}

];

我需要在Widgets模块中使用Directory Search模块的所有功能。因此,我将目录搜索模块导入窗口小部件模块。

在应用路由“目录搜索”模块和“小组件”模块的路由中,分别定义如下,

export const appRoutes: Routes = [
{ path: 'directory-search', loadChildren: 'app/modules/directory-search/directory-search.module#DirectorySearchModule' },
{ path: 'widgets', loadChildren: 'app/modules/widgets/widgets.module#WidgetsModule' }

];

当我的应用使用http://localhost:4200/#/widgets的路由执行时,它显示的是DirectorySearchComponent而不是WidgetDashboardComponent。

我在做什么错? 我尝试更改路由的顺序,但是没有用。 谢谢

0 个答案:

没有答案
相关问题