Angular: Metadata collected contains an error that will be reported at runtime: Lambda not supported
问题 In my Angular app, I'm trying to use a factory provider in my module: export function getMyFactory(): () => Window { return () => window; } @NgModule({ providers: [ { provide: WindowRef, useFactory: getMyFactory() }, ], }) export class MyModule {} but this is failing with: Error encountered in metadata generated for exported symbol 'MyModule': Metadata collected contains an error that will be reported at runtime: Lambda not supported 回答1: I've found an easy solution reported on a thread from