简体   繁体   English

Angular模块无法识别导入的模块

[英]Angular Modules not recognizing imported modules

I am trying to import a module into a home-page module, but it is throwing a TypeScript error stating that it cannot find the module despite the fact that it is defined. 我正在尝试将模块导入主页模块,但是它抛出TypeScript错误,表明尽管定义了该模块却找不到该模块。 This is the terminal error - 这是终端错误-

ERROR in src/app/home-page/home-page.module.ts(11,5): error TS2304: Cannot find name 'UtilityComponentModule'. src / app / home-page / home-page.module.ts(11,5)中的错误:错误TS2304:找不到名称“ UtilityComponentModule”。

My UtilityComponentModule is set up- 我的UtilityComponentModule已设置-

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ModalWindowComponent } from './modal-window/modal-window.component';

@NgModule({
  imports: [
    CommonModule
  ],
  declarations: [
    ModalWindowComponent
  ],
  exports: [
    ModalWindowComponent
  ]
})
export class UtilityComponentModule { }

And the module I'm attempting to import it into is set up as - 我尝试将其导入的模块设置为-

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HomePageControllerComponent } from './home-page-controller/home-page-controller.component';
import { LanguageBarComponent } from './language-bar/language-bar.component';
import { SnippetAdderComponent } from './snippet-adder/snippet-adder.component';
import { SnippetCardComponent } from './snippet-card/snippet-card.component';

@NgModule({
  imports: [
    CommonModule,
    UtilityComponentModule
  ],
  declarations: [
    HomePageControllerComponent,
    LanguageBarComponent,
    SnippetAdderComponent,
    SnippetCardComponent
  ],
  exports: [
    HomePageControllerComponent
  ]
})
export class HomePageModule { }

Completely blindsided as to what could be causing this error. 对于可能导致此错误的原因完全不了解。

Thank you in advance for any suggestions or direction you have. 预先感谢您的任何建议或指示。

Cheers! 干杯!

您需要将其添加到第二个文件顶部的import列表中,如下所示:

import { UtilityComponentModule } from 'your path';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM