Javascript Can';不理解错误';td对话&x27;不是已知元素
各位!!我有一个关于角度模块化的问题。问题就在这里Javascript Can';不理解错误';td对话&x27;不是已知元素,javascript,angular,typescript,module,Javascript,Angular,Typescript,Module,各位!!我有一个关于角度模块化的问题。问题就在这里 ERROR in src/app/components/common/dialog/confirm-dialog/confirm-dialog.component.html:1:1 - error NG8001: 'td-dialog' is not a known element: 1. If 'td-dialog' is an Angular component, then verify that it is part of this mo
ERROR in src/app/components/common/dialog/confirm-dialog/confirm-dialog.component.html:1:1 - error NG8001: 'td-dialog' is not a known element:
1. If 'td-dialog' is an Angular component, then verify that it is part of this module.
2. If 'td-dialog' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
我不明白为什么它不是一个已知的元素,因为我已经导入了包含td对话框选择器的模块(Teradata CovalentCovalentDialogModule
)。下面是两个模块的代码示例:发生错误的模块和根模块
// Module with 'td-dialog' is not a known element error
import { NgModule } from '@angular/core';
import { ConfirmDialogComponent } from './dialog/confirm-dialog/confirm-dialog.component';
import {commonModules} from '../../app.module';
@NgModule({
declarations: [
ConfirmDialogComponent
],
imports: [
commonModules
],
exports: []
})
export class CommonComponentsModule { }
正如您所看到的,我在CommonComponentsModule
中使用“td dialog”选择器导入模块,但看不到出现问题的原因。以前,commonModules
不是modules数组的变量,而是另一个只包含导出的模块,它包含commonModules
中的所有模块,但错误仍然相同
我花了很长时间寻找答案,但找不到任何答案,我已经检查了导入,并尝试将
CUSTOM\u ELEMENTS\u SCHEMA
添加到我的根模块和子模块中,但这没有奏效,因为td dialog
是一个角度组件。我想我已经找到了错误
请从代码中更改此代码段
imports: [
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
commonModules,
appRouting
],
到
您需要将commonModules
中的模块包含在imports
中。更多你可以阅读
您的
commonComponents模块中也需要更新,声明列表中未导入td对话框
。我在Teradata共价文档中找不到任何td对话框
提及的内容。你确定它存在吗?是的,它存在于CovalentDialogModule
中<代码>td对话框
只是扩展了mat对话框
标签。谢谢!这是一个交易,我只是不明白为什么原始代码段在根模块中工作,而不是在子模块中
imports: [
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
commonModules,
appRouting
],
imports: [
HttpClientModule,
BrowserModule,
BrowserAnimationsModule,
...commonModules,
appRouting
],