Home > other >  Problem with imports/exports/declarations component in Angular
Problem with imports/exports/declarations component in Angular

Time:09-25

I have a component created, as you can see in the code sample, I import it, export it and even declare it, but it doesn't take me. Can you please tell me what the problem may be?

Error: Appears in the NgModule.imports of SalesModule, but could not be resolved to an NgModule class. Is it missing an @NgModule annotation? 9 export class PaymentStatusComponent implements OnInit {

sales.module.ts:

@NgModule({
    exports: [PaymentStatusComponent],
    imports: [PaymentStatusComponent],
    declarations: [PaymentStatusComponent]
})
export class SalesModule {}

CodePudding user response:

Thankfully this is a simple fix.

Remove PaymentStatusComponent from the imports array.

Why? Because it's a component and the imports array only takes modules.

  • Related