// in app.module.ts providers: [ { provide: Window, useValue: window } ] // in component: Then you can just inject it directly anywhere you want - e.g. in a service: constructor(private window: Window) { // ...