Skip to content Skip to sidebar Skip to footer

Can't Get Ionic V4 Cli Generated Component To Work

I'm currently working with the latest Ionic and I'm having a hard time trying to get a CLI generates component to work. I start with a blank proyect and then create a new component

Solution 1:

In order to use a custom component inside another component you have to include it in exports array.

@NgModule({
  ....
  declarations: [AppComponent, MyComponentComponent],
  entryComponents: [],
  exports:[MyComponentComponent]
  ....
})
export class AppModule {}

You can either do this way or you can make all your custom components inside another customModule and then import that module in app.component.ts page.

The name you are referring to the component is wrong. selector for your MyComponentComponent class is app-my-component, so you have to use <app-my-component></app-my-component> instead of <my-component></my-component>.

Post a Comment for "Can't Get Ionic V4 Cli Generated Component To Work"