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