In my Angular 2 application I provide the window object using what is described here: Angular2 - How to inject window into an angular2 service.
However the ngc compiler used for AOT returns several errors. First I had to change the way I provide the dependency (note the 'Window'):
@NgModule({
providers: [
{ provide: 'Window', useValue: window }
],
...
})
export class AppModule {}
And in my component (note the type 'any'):
@Component({ ... })
export default class MyComponent {
constructor (
@Inject('Window') private window: any
) {}
...
However I still get the following error thrown by the ngc compiler in my module ngfactory:
Property 'window' does not exist on type
Again everything is working fine with the tsc compiler.