我正在创建一个路由机制在我的角度项目,但我得到了URL路由错误。应用程序找不到URL。
这是我的路由机制。
navigation.ts
{
id: 'documentation-management',
title: 'Dokümantasyon Yönetimi',
type: 'collapse',
icon: 'feather icon-folder',
children: [
{
id: 'documentation-list',
title: 'Doküman Listesi',
type: 'item',
url: '/tr/documentation-management/documentation/documentation-list'
},
{
id: 'definitions',
title: 'Tanımlar',
type: 'collapse',
children: [
{
id: 'documentation-category',
title: 'Doküman Kategorileri',
type: 'item',
url: '/tr/documentation-management/definitions/documentation-category/documentation-category-list'
}
]
}
]
}app-routing.module.ts
{
path: ':lang/documentation-management',
loadChildren: './documentation-management/documentation-management.module#DocumentationManagementModule'
}documentation-management-routing.module.ts
const routes: Routes = [
{
path: '',
children: [
{
path: 'documentation',
loadChildren: './documentation/documentation.module#DocumentationModule'
},
{
path: 'definitions',
loadChildren: './definitions/definitions.module#DefinitionsModule'
}
]
}
];definitions-routing.module.ts
const routes: Routes = [
{
path: '',
children: [
{
path: 'documentation-category',
loadChildren: './documentation-category/documentation-category.module#DocumentationCategoryModule'
}
]
}
];documentation-category-routing.module.ts
const routes: Routes = [
{
path: '',
children: [
{
path: 'documentation-category-list',
loadChildren: './documentation-category-list/documentation-category-list.module#DocumentationCategoryListModule'
},
{
path: 'documentation-category-edit',
loadChildren: './documentation-category-edit/documentation-category-edit.module#DocumentationCategoryEditModule'
},
{
path: 'documentation-category-edit/:id',
loadChildren: './documentation-category-edit/documentation-category-edit.module#DocumentationCategoryEditModule'
}
]
}
];documentation-category-list-routing.module.ts
const routes: Routes = [
{
path: '',
component: DocumentationCategoryListComponent
}
];对于不同的模块,我有相同的路由机制,并且正在工作。我不知道这不管用。
我应该能够转到navigation.ts文件中指定的URL,但我得到的错误如下:
ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'tr/documentation-management/definitions/documentation-category/documentation-category-list'
Error: Cannot match any routes. URL Segment: 'tr/documentation-management/definitions/documentation-category/documentation-category-list'以下是我的应用程序结构:
- app
- documentation-management
- definitions
- documentation-category
- documentation-category-list
- human-resources
- definitions
- education-group
- education-group-list你能帮我吗?
发布于 2019-08-27 11:56:21
在app.routing.module.ts中
const routes: Routes = [
{ path: 'documentation-management', loadChildren: () => import('./path to the module/documentation-management.module').then(mod => mod.documentationManagement)
}
];在文档管理的路由模块中,导入与此相同的其他模块。
发布于 2019-08-27 13:43:34
我解决了问题。在其路由机制中,角不允许相同的模块名。这些模块在不同的文件夹结构中并不重要。
当我改变的时候;
{
path: 'definitions',
loadChildren: './definitions/definitions.module#DefinitionsModule'
}至
{
path: 'definitions',
loadChildren: './definitions/definitions.module#DocumentationManagementDefinitionsModule'
}啊,真灵。
https://stackoverflow.com/questions/57673641
复制相似问题