我的問題是當我添加兒童路線時。/聯系人/...)到聯系配置模塊,他們禁用根路由,但當我注釋它們時,它正常工作
一個朋友說這是一個權限問題,我打算把它做成一個分開的下拉菜單,但是當他說我搜索了一下,但是我沒有找到問題
聯系人-配置.模塊. ts
` `import { ModuleWithProviders, NgModule } from '@angular/core';
import { CONTACT_ROUTE_PROVIDERS } from './providers/route.provider';
import { CONTACT_INFOS_CONTACT_INFO_ROUTE_PROVIDER } from './providers/contact-info-route.provider';
import { PERSONALS_PERSONAL_ROUTE_PROVIDER } from './providers/personal-route.provider';
import { ORGANIZATIONS_ORGANIZATION_ROUTE_PROVIDER } from './providers/organization-route.provider';
import { ADDRESSES_ADDRESS_ROUTE_PROVIDER } from './providers/address-route.provider';
import { NATURE_TYPES_NATURE_TYPE_ROUTE_PROVIDER } from './providers/nature-type-route.provider';
import { CONTACT_NATURES_CONTACT_NATURE_ROUTE_PROVIDER } from './providers/contact-nature-route.provider';
import { EXPERIENCE_TYPES_EXPERIENCE_TYPE_ROUTE_PROVIDER } from './providers/experience-type-route.provider';
import { EXPERTS_EXPERT_ROUTE_PROVIDER } from './providers/expert-route.provider';
import { ORGANIZATION_STAKEHOLDERS_ORGANIZATION_STAKEHOLDER_ROUTE_PROVIDER } from './providers/organization-stakeholder-route.provider';
import { NATURE_TYPES_NATURE_TYPE_TRANSLATION_ROUTE_PROVIDER } from './providers/nature-type-translation-route.provider';
import { CONTACT_INFOS_CONTACT_INFO_TRANSLATION_ROUTE_PROVIDER } from './providers/contact-info-translation-route.provider';
import { EXPERIENCE_TYPES_EXPERIENCE_TYPE_TRANSLATION_ROUTE_PROVIDER } from './providers/experience-type-translation-route.provider';
@NgModule()
export class ContactConfigModule {
static forRoot(): ModuleWithProviders<ContactConfigModule> {
return {
ngModule: ContactConfigModule,
providers: [
CONTACT_ROUTE_PROVIDERS,
CONTACT_INFOS_CONTACT_INFO_ROUTE_PROVIDER,
PERSONALS_PERSONAL_ROUTE_PROVIDER,
ORGANIZATIONS_ORGANIZATION_ROUTE_PROVIDER,
ADDRESSES_ADDRESS_ROUTE_PROVIDER,
NATURE_TYPES_NATURE_TYPE_ROUTE_PROVIDER,
CONTACT_NATURES_CONTACT_NATURE_ROUTE_PROVIDER,
EXPERIENCE_TYPES_EXPERIENCE_TYPE_ROUTE_PROVIDER,
EXPERTS_EXPERT_ROUTE_PROVIDER,
ORGANIZATION_STAKEHOLDERS_ORGANIZATION_STAKEHOLDER_ROUTE_PROVIDER,
NATURE_TYPES_NATURE_TYPE_TRANSLATION_ROUTE_PROVIDER,
CONTACT_INFOS_CONTACT_INFO_TRANSLATION_ROUTE_PROVIDER,
EXPERIENCE_TYPES_EXPERIENCE_TYPE_TRANSLATION_ROUTE_PROVIDER,
],
};
}
}`
`
路由.提供商. ts(根)
import { eLayoutType, RoutesService } from '@abp/ng.core';
import { APP_INITIALIZER } from '@angular/core';
import { eContactRouteNames } from '../enums/route-names';
export const CONTACT_ROUTE_PROVIDERS = [
{
provide: APP_INITIALIZER,
useFactory: configureRoutes,
deps: [RoutesService],
multi: true,
},
];
export function configureRoutes(routes: RoutesService) {
return () => {
routes.add([
{
path: '/contact',
name: eContactRouteNames.Contact,
iconClass: 'fas fa-book',
layout: eLayoutType.application,
order: 3,
requiredPolicy:'Contact.ContactInfos'
},
]);
};
}
聯系人-路由.模塊. ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { ContactComponent } from './components/contact.component';
import { loadContactInfoModuleAsChild } from './contact-infos/contact-info/contact-info.module';
import { loadPersonalModuleAsChild } from './personals/personal/personal.module';
import { loadOrganizationModuleAsChild } from './organizations/organization/organization.module';
import { loadAddressModuleAsChild } from './addresses/address/address.module';
import { loadNatureTypeModuleAsChild } from './nature-types/nature-type/nature-type.module';
import { loadContactNatureModuleAsChild } from './contact-natures/contact-nature/contact-nature.module';
import { loadExperienceTypeModuleAsChild } from './experience-types/experience-type/experience-type.module';
import { loadExpertModuleAsChild } from './experts/expert/expert.module';
import { loadOrganizationStakeholderModuleAsChild } from './organization-stakeholders/organization-stakeholder/organization-stakeholder.module';
import { loadNatureTypeTranslationModuleAsChild } from './nature-types/nature-type-translation/nature-type-translation.module';
import { loadContactInfoTranslationModuleAsChild } from './contact-infos/contact-info-translation/contact-info-translation.module';
import { loadExperienceTypeTranslationModuleAsChild } from './experience-types/experience-type-translation/experience-type-translation.module';
const routes: Routes = [
{
path: '',
pathMatch: 'full',
component: ContactComponent,
},
{ path: 'contact-infos', loadChildren: loadContactInfoModuleAsChild },
{ path: 'personals', loadChildren: loadPersonalModuleAsChild },
{ path: 'organizations', loadChildren: loadOrganizationModuleAsChild },
{ path: 'addresses', loadChildren: loadAddressModuleAsChild },
{ path: 'nature-types', loadChildren: loadNatureTypeModuleAsChild },
{ path: 'contact-natures', loadChildren: loadContactNatureModuleAsChild },
{ path: 'experience-types', loadChildren: loadExperienceTypeModuleAsChild },
{ path: 'experts', loadChildren: loadExpertModuleAsChild },
{ path: 'organization-stakeholders', loadChildren: loadOrganizationStakeholderModuleAsChild },
{ path: 'nature-type-translations', loadChildren: loadNatureTypeTranslationModuleAsChild },
{ path: 'contact-info-translations', loadChildren: loadContactInfoTranslationModuleAsChild },
{
path: 'experience-type-translations',
loadChildren: loadExperienceTypeTranslationModuleAsChild,
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ContactRoutingModule {}
聯系人.模塊. ts
import { NgModule, NgModuleFactory, ModuleWithProviders } from '@angular/core';
import { CoreModule, LazyModuleFactory } from '@abp/ng.core';
import { ThemeSharedModule } from '@abp/ng.theme.shared';
import { ContactComponent } from './components/contact.component';
import { ContactRoutingModule } from './contact-routing.module';
import { ReactiveFormsModule } from '@angular/forms';
import { ChartModule } from '@abp/ng.components/chart.js';
import { CommercialUiModule } from '@volo/abp.commercial.ng.ui';
@NgModule({
declarations: [ContactComponent],
imports: [CoreModule, ThemeSharedModule, ContactRoutingModule,ReactiveFormsModule,ChartModule,CommercialUiModule],
exports: [ContactComponent],
})
export class ContactModule {
static forChild(): ModuleWithProviders<ContactModule> {
return {
ngModule: ContactModule,
providers: [],
};
}
static forLazy(): NgModuleFactory<ContactModule> {
return new LazyModuleFactory(ContactModule.forChild());
}
}
app-routing.module.ts
import { AuthGuard, PermissionGuard } from '@abp/ng.core';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [
// {
// path: '',
// pathMatch: 'full',
// loadChildren: () => import('./home/home.module').then(m => m.HomeModule),
// },
// { path: 'my-dashboard', component: MyDashBoardComponent },
{
path: '',
pathMatch: 'full',
loadChildren: () => import('./myhome/myhome.module').then(m => m.MyHomeModule),
},
{
path: 'dashboard',
loadChildren: () => import('./dashboard/dashboard.module').then(m => m.DashboardModule),
canActivate: [AuthGuard, PermissionGuard],
},
{
path: 'contact',
loadChildren: () =>
import('../../projects/contact/src/lib/contact.module').then(m => m.ContactModule.forLazy()),
},
{
path: 'account',
loadChildren: () =>
import('../../projects/account/public/src/account-public.module').then(m => m.AccountPublicModule.forLazy()),
},
{
path: 'file-management',
loadChildren: () =>
import('../../projects/file-management/src/lib/file-management.module').then(m => m.FileManagementModule.forLazy()),
},
{
path: 'gdpr',
loadChildren: () => import('@volo/abp.ng.gdpr').then(m => m.GdprModule.forLazy()),
},
{
path: 'identity',
loadChildren: () => import('../../projects/identity/src/lib/identity.module').then(m => m.IdentityModule.forLazy()),
},
{
path: 'language-management',
loadChildren: () =>
import('../../projects/language-management/src/lib/language-management.module').then(m => m.LanguageManagementModule.forLazy()),
},
{
path: 'saas',
loadChildren: () => import('../../projects/saas/src/lib/saas.module').then(m => m.SaasModule.forLazy()),
},
{
path: 'audit-logs',
loadChildren: () =>
import('../../projects/audit-logging/src/lib/audit-logging.module').then(m => m.AuditLoggingModule.forLazy()),
},
{
path: 'openiddict',
loadChildren: () =>
import('../../projects/openiddictpro/src/lib/openiddictpro.module').then(m => m.OpeniddictproModule.forLazy()),
},
{
path: 'text-template-management',
loadChildren: () =>
import('@volo/abp.ng.text-template-management').then(m =>
m.TextTemplateManagementModule.forLazy()
),
},
{
path: 'setting-management',
loadChildren: () =>
import('@abp/ng.setting-management').then(m => m.SettingManagementModule.forLazy()),
},
{
path: 'core',
loadChildren: () =>
import('../../projects/core/src/lib/core.module').then(m => m.CorModule.forLazy()),
},
{
path: 'power-of-attorneys',
loadChildren: () =>
import('../../projects/power-of-attorneys/src/lib/power-of-attorneys.module').then(m => m.PowerOfAttorneysModule.forLazy()),
},
{
path: 'litigations',
loadChildren: () =>
import('../../projects/litigations/src/lib/litigations.module').then(m => m.LitigationsModule.forLazy()),
},
{
path: 'administrative-works',
loadChildren: () =>
import('../../projects/administrative-works/src/lib/administrative-works.module').then(m => m.AdministrativeWorksModule.forLazy()),
},
{
path: 'gdpr-cookie-consent',
loadChildren: () =>
import('./gdpr-cookie-consent/gdpr-cookie-consent.module').then(
m => m.GdprCookieConsentModule
),
},
];
@NgModule({
imports: [RouterModule.forRoot(routes, {})],
exports: [RouterModule],
})
export class AppRoutingModule {}