In whatever component you are using window, inject PLATFORM_ID as well:
constructor(@Inject(PLATFORM_ID) private platformId: Object) {}
ngOnInit() {
if (isPlatformBrowser(this.platformId)) {
// This code will only run in the browser
console.log(window);
}
}
Now you're good to go.