Skip to main content

How do you load a custom component in ionic 4?

Published 1 min readMarkdown
How do you load a custom component in ionic 4?

(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

About the author

  • Angular | Ionic Framework | Node.js

No comments yet. Be the first to comment.

More from this blog