Making your Angular 2 library statically analyzable for AoT
Isaac Mann

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: [


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

can you help me?