我创建了一些使用其他组件的组件。除了我创建的最后一个组件外,所有组件都可以正常工作。这是 HTML 中的代码:
<window [(ngModele)]="isOpen"></window>
这是我的新组件的模块:
@NgModule({
imports: [
CommonModule,
ComponentsModule,
FormsModule
],
declarations: [
MyNewComponent
],
exports: [
MyNewComponent
]
})
export class MyNewModule { }
在进口中有ComponentsModule
包含WindowComponent
:
@NgModule({
imports: [
CommonModule,
FormsModule,
PipeModule,
RouterModule
],
declarations: [
WindowComponent,
// OTHER COMPONENTS
],
exports: [
WindowComponent,
// OTHER COMPONENTS
]
})
export class ComponentsModule { }
在最后一个组件控制台中,在构建时向我显示此错误:
src/app/areas/wins/my.new.component/my.new.component.html:1:1 - error NG8001: 'window' is not a known element:
1. If 'window' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.
添加NO_ERRORS_SCHEMA
和CUSTOM_ELEMENTS_SCHEMA
完全没用。Angular 模块有什么问题?