src/window-ref.ts
constructor(platformId: any)
|
||||||||
Defined in src/window-ref.ts:5
|
||||||||
Parameters :
|
nativeWindow |
getnativeWindow()
|
Defined in src/window-ref.ts:8
|
_window |
get_window()
|
Defined in src/window-ref.ts:12
|
import { Injectable, PLATFORM_ID, Inject } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
@Injectable()
export class WindowRef {
constructor(@Inject(PLATFORM_ID) private platformId: any) {}
get nativeWindow(): any {
return this._window;
}
private get _window(): any {
if (isPlatformBrowser(this.platformId)) {
return window;
}
return {} as any;
}
}