角度-找不到模块

时间:2019-07-01 11:47:07

标签: angular jhipster

我使用JHipster(简单的Java + Angular应用程序)创建了应用程序。当我将项目编译为产品概要文件时,我得到 Error。 使用AppRoutingModule添加了管理模块,代码如下:

@NgModule({
  imports: [
    RouterModule.forRoot(
      [
        {
          path: 'admin',
          loadChildren: './admin/admin.module#DepozytKlAdminModule'
        },
        ...LAYOUT_ROUTES
      ],
      { enableTracing: false }
    )
  ],
  exports: [RouterModule]
})
export class DepozytKlAppRoutingModule {}

还有app.module:

@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    NgxWebstorageModule.forRoot({ prefix: 'dkl', separator: '-' }),
    NgJhipsterModule.forRoot({
      // set below to true to make alerts look like toast
      alertAsToast: false,
      alertTimeout: 5000,
      i18nEnabled: true,
      defaultI18nLang: 'pl'
    }),
    DepozytKlSharedModule.forRoot(),
    DepozytKlCoreModule,
    DepozytKlHomeModule,
    DepozytKlAccountModule,
    DepozytKlEntityModule,
    DepozytKlAppRoutingModule,
    // jhipster-needle-angular-add-module JHipster will add new module here
  ],
  declarations: [ ... ],
  providers: [ ... ],
  bootstrap: [DklMainComponent]
})
export class DepozytKlAppModule {
  constructor(private dpConfig: NgbDatepickerConfig) {
    this.dpConfig.minDate = { year: moment().year() - 100, month: 1, day: 1 };
  }
}

有趣的事实是PROD配置文件有效(实体部分),我在管理模块上遇到了问题。 admin.module.ts:

@NgModule({
  imports: [
    DepozytKlSharedModule,
    /* jhipster-needle-add-admin-module - JHipster will add admin modules here */
    RouterModule.forChild(adminState),
    DepozytKlOrganisationModule
  ],
  declarations: [
    AuditsComponent,
    UserMgmtComponent,
    UserMgmtDetailComponent,
    UserMgmtUpdateComponent,
    UserMgmtDeleteDialogComponent,
    LogsComponent,
    DklConfigurationComponent,
    DklHealthCheckComponent,
    DklHealthModalComponent,
    DklDocsComponent,
    DklMetricsMonitoringComponent,
    UserMgmtUpdateExtendedComponent
  ],
  providers: [{ provide: JhiLanguageService, useClass: JhiLanguageService }],
  entryComponents: [
    UserMgmtDeleteDialogComponent,
    DklHealthModalComponent,
    UserMgmtUpdateExtendedComponent,
    OrganisationTreeSelectionComponent,
    OrganisationTreeComponent
  ],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class DepozytKlAdminModule {
  constructor(private languageService: JhiLanguageService, private languageHelper: JhiLanguageHelper) {
    this.languageHelper.language.subscribe((languageKey: string) => {
      if (languageKey !== undefined) {
        this.languageService.changeLanguage(languageKey);
      }
    });
  }
}

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

未正确连接OrganisationModule和Organization Components。解决了