我正在尝试将模块导入主页模块,但是它引发TypeScript错误,表明尽管定义了该模块却找不到该模块。这是终端错误-
src / app / home-page / home-page.module.ts(11,5)中的错误:错误TS2304:找不到名称“ UtilityComponentModule”。
我的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 { }
我尝试将其导入的模块设置为-
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 { }
完全不了解可能导致此错误的原因。
在此先感谢您的任何建议或指导。
干杯!
答案 0 :(得分:1)
您需要将其添加到第二个文件顶部的import
列表中,
import { UtilityComponentModule } from 'your path';