3

After my angular app migration from 8.2 to angular 9 I'm facing the following error:

ERROR in Symbol XptoComponent declared in C:/path/xpto.component.ts is not exported from @angular/core (import into C:/path/parts.module.ts).

The code is:

@NgModule({
    declarations: [
        forwardRef(() => XptoComponent ),
    ],
    imports: [
        CommonModule,
    ],
    providers: [],
    exports: [forwardRef(() => XptoComponent ), CommonModule,
    ]
})
export class PartsModule {

    public static forRoot(): ModuleWithProviders<PartsModule> {
    return {
        ngModule: PartsModule
    };
}

and the component

@Component({
    selector: 'stuff',
    templateUrl: './stuff.component.html',

})
export class XptoComponent {
}

I've found that the error is related with forwardRef but how can i handle this using forwardRef (i need it).

JMarques
  • 3,044
  • 4
  • 34
  • 55

0 Answers0