Angular 11 中的疯狂模块行为

时间:2021-01-11 16:12:09

标签: angular angular-module angular-lazyloading

我创建了一些使用其他组件的组件。除了我创建的最后一个组件外,所有组件都可以正常工作。这是 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_SCHEMACUSTOM_ELEMENTS_SCHEMA 完全没用。 Angular 模块有什么问题?

0 个答案:

没有答案
相关问题