Making your Angular 2 library statically analyzable for AoT
Isaac Mann
21933

I am creating a simple lib, and I keep running in this problem:
ERROR in Error encountered resolving symbol values statically. Calling function ‘NFEModule’, function calls are not supported. Consider replacing the function or lambda with a reference
to an exported function, resolving symbol AppModule in …/Frontend/src/app/app.module.ts, resolving symbol AppModule in …/Frontend/src/app/app.module.ts

My lib starts with a parameter:

export class NFEModule {

static forRoot(host: string): ModuleWithProviders {

environment.API_URL = host;

return {

ngModule: NFEModule

}

}

}

and I instantiate it this way on my AppModule:

imports: [
NFEModule.forRoot(environment.API_URL),

]

if I remove this “forRoot”, everything works, but I can’t pass a parameter to my lib

can you help me?

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.