Ionic 5 Custom Angular Components not showing

I can’t seem to get custom Angular components to display in Ionic 5.

Steps to reproduce:

  • Generate a blank Ionic app
  • Generate a component with ionic generate component components/dougi
  • Import Component reference into app.module.ts
  • Add class reference to declarations, entryComponents, exports etc (none seem to make any difference)
  • Add to the file


import { Component, OnInit } from '@angular/core';

  selector: 'app-dougi',
  templateUrl: './dougi.component.html',
  styleUrls: ['./dougi.component.scss'],
export class DougiComponent implements OnInit {

  constructor() { }

  ngOnInit() {}


<ion-header [translucent]="true">

<ion-content [fullscreen]="true">
  <ion-header collapse="condense">
      <ion-title size="large">Blank</ion-title>

  <div id="container">


import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

import { DougiComponent } from './components/dougi/dougi.component';

  declarations: [
  entryComponents: [
  imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule],
  providers: [
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  bootstrap: [AppComponent],
  exports: [
export class AppModule {}

Browser console output:

'app-dougi' is not a known element:
1. If 'app-dougi' is an Angular component, then verify that it is part of this module.
2. If 'app-dougi' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

What am I doing wrong please?

1 Like

If you are lazy loading, then it must be the home page module that is missing a reference to the custom component. Try importing it there as well and see if this is resolved

1 Like

Thanks. I assume you mean like this?

import { Component } from '@angular/core';
import { DougiComponent } from '../components/dougi/dougi.component';

  selector: 'app-home',
  templateUrl: '',
  styleUrls: [''],
  entryComponents: [DougiComponent]
export class HomePage {

  constructor() {}


Unfortunately, that doesn’t work. Same error :frowning:

1 Like

Maybe try a components module that controls the custom components, and import that to your app.module and any page modules that use it

1 Like

Thank you. That worked. For those wanting specific instructions on this there is a good overview here.

1 Like

I think lazy loading is the default.