【发布时间】:2017-10-31 15:00:35
【问题描述】:
我正在尝试为我的选项卡创建标题/导航栏组件,但在使用 ion-tabs 的组件中遇到问题。
它引发错误:1. If ‘custom-header’ is an Angular component, then verify that it is part of this module.
我试图将我的组件加载到同一个项目的正常页面中,它在其中可以正常工作。 但在标签中,它会引发错误。
这是我的代码。
navbar.html
<ion-header>
<ion-navbar>
<ion-title></ion-title>
<ion-chip>
<button ion-button clear color="light">
<ion-icon class="fa fa-microphone"></ion-icon>
</button>
</ion-chip>
</ion-navbar>
</ion-header>
我在navbar.ts中的选择器
我的 component.module.ts
@Component({
selector: 'navbar',
templateUrl: 'navbar.html'
})
import { NgModule } from '@angular/core';
import { NavbarComponent } from './navbar/navbar';
@NgModule({
declarations: [NavbarComponent],
imports: [],
exports: [NavbarComponent]
})
export class ComponentsModule {}
我的标签页主/父页面
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { DashboardPage } from './dashboard';
import { ComponentsModule }from '../../components/components.module';
@NgModule({
declarations: [
DashboardPage,
ComponentsModule
],
imports: [
IonicPageModule.forChild(DashboardPage),
ComponentsModule
]
})
export class DashboardPageModule {}
我在app.module.ts中添加了这个组件
任何帮助将不胜感激。谢谢。
【问题讨论】:
标签: angular typescript ionic-framework ionic3