Ionic 4 (Angular 7) - sharing components issue

会有一股神秘感。 提交于 2019-12-05 16:27:08

you additionally have to add the ionic module to your shared module like this:

import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { HeaderComponent } from '../header/header.component';
import { IonicModule } from 'ionic-angular';

@NgModule({
  imports: [
    CommonModule,
    IonicModule
  ],
  declarations: [
    HeaderComponent
  ],
  exports: [
    HeaderComponent
  ]
})

export class SharedModule {}

if you are using ionic 4 you have to edit the import of IonicModule to this:

import { IonicModule } from '@ionic/angular';

In my case the issue was that I was trying to include a custom component in a component that is opened with a modal. I needed to add my component to the parent page's module.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!