首页 > 解决方案 > 不是已知元素。请确认它是此模块的一部分

问题描述

我创建了一个组件模块并将其导入 app.module.ts。

组件/组件.module.ts:

// import stuff........
@NgModule({
    declarations: [
        ComponentA,
        ComponentB,
        ComponentC
    ],
    imports: [
        IonicModule,
        PipesModule
    ],
    exports: [
        ComponentA,
        ComponentB,
        ComponentC
    ],
    entryComponents: [
        SearchTabComponent
    ],
    schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ComponentsModule { }

app.module.ts

@NgModule({
    declarations: [
        MyApp,
        PageA,
        PageB
    ],
    imports: [
        BrowserModule,
        IonicModule.forRoot(MyApp, { tabsHideOnSubPages: true }),
        IonicStorageModule.forRoot(),
        AuthModule,
        HttpModule,
        PipesModule,
        ComponentsModule,
        DirectivesModule,
        IonicImageViewerModule
    ],
    bootstrap: [IonicApp],
    entryComponents: [
        MyApp,
        PageA,
        PageB
    ],
    providers: []
})
export class AppModule { }

该应用程序运行良好,但在 .html 部分显示它不是模块的一部分。

标签: angularionic3

解决方案


推荐阅读