Hi,
Right now Im having issue with a custom component.
What I’ve done:
I’ve generated the component in the CLI
ionic g component components/accordion-list
Now, I get the error:
ERROR Error: Uncaught (in promise): Error: Unexpected directive ‘AccordionListComponent’ imported by the module ‘PresetsPageModule’. Please add a @NgModule annotation.
This after I have imported the AccordionListComponent in the presets.module.ts (since I only use that component on that specific page) like this:
@NgModule({
imports: [
AccordionListComponent,
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes)
],
declarations: [PresetsPage]
})
export class PresetsPageModule {}
Also, in my app.module.ts looks like this:
@NgModule({
declarations: [
AppComponent,
AccordionListComponent],
entryComponents: [],
imports: [
BrowserModule,
IntegrationModalPageModule,
PrislistorModalPageModule,
InstallningarModalPageModule,
IonicModule.forRoot(),
AppRoutingModule],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
Obviously I’m doing something wrong. I noticed that in components/accordion-list there are only 4-files. There is no accordion-list.module.ts-file? Still getting error:
ERROR Error: Uncaught (in promise): Error: Unexpected directive ‘AccordionListComponent’ imported by the module ‘PresetsPageModule’. Please add a @NgModule annotation.
Help is appreciated
All the best,