File

src/window-ref.ts

Constructor

constructor(platformId: any)
Parameters :
Name Type Optional Description
platformId any

Accessors

nativeWindow
getnativeWindow()
_window
get_window()
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;
  }
}

results matching ""

    No results matching ""