Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 3 can't use ion-* components inside my custom components

I have recently upgraded to Ionic 3 from Ionic 2, and I created components.module.ts file and declared and exported each custom component I have, and then imported this single file in every page module I have.

So now the problem is that I can't use ion-* components inside my own components, because I did not imported the IonicModule.forRoot(..) inside my components.module.

The error is:

"Template parse errors: 'ion-spinner' is not a known element ..."

What am I doing wrong?

like image 792
Eliran Pe'er Avatar asked Apr 15 '17 10:04

Eliran Pe'er


1 Answers

Alright, so I figured out the solution:

All i needed was to import IonicModule in components.module, without forRoot(..).

Also note that Angular's CommonModule is also necessary to make Angular's directives work, so you probably need to import it too.

like image 76
Eliran Pe'er Avatar answered Sep 30 '22 15:09

Eliran Pe'er