How do you load a custom component in ionic 4?

yshnv
Marvenics
Published in
1 min readApr 18, 2019
(source : Google)

First create a component

ionic start myProject blank --type=angular
ionic g module components
ionic g component components/myComponent --export

This adds both a declaration and export to the components module for “myComponent”.

To use the component just add ComponentsModule to your imports in your page module, e.g.

This way nothing is added to app.module.ts which is how it should be.

Also note if you want to use any components in your own custom components, you need to add IonicModule to the imports in components.module.ts

--

--

yshnv
Marvenics

Angular | Ionic Framework | ExpressJS | UIUX