File

projects/rebirth-ng/src/lib/window-ref/window-ref.service.ts

Index

Methods

Constructor

constructor(documentRef: DocumentRef)
Parameters :
Name Type Optional
documentRef DocumentRef no

Methods

getBoundingClientRect
getBoundingClientRect(elementRef: ElementRef)
Parameters :
Name Type Optional
elementRef ElementRef no
Returns : any
getComputedStyle
getComputedStyle(element: )
Parameters :
Name Optional
element no
Returns : any
getOffsetWidth
getOffsetWidth(elementRef: ElementRef)
Parameters :
Name Type Optional
elementRef ElementRef no
Returns : any

Accessors

document
getdocument()
pageXOffset
getpageXOffset()
pageYOffset
getpageYOffset()
innerHeight
getinnerHeight()
innerWidth
getinnerWidth()
import { Injectable, ElementRef } from '@angular/core';
import { DocumentRef } from './document-ref.service';

@Injectable({ providedIn: 'root' })
export class WindowRef {

  constructor(private  documentRef: DocumentRef) {
  }

  get document(): any {
    return this.documentRef;
  }

  get pageXOffset() {
    return window.pageXOffset;
  }


  get pageYOffset() {
    return window.pageYOffset;
  }

  get innerHeight() {
    return window.innerHeight;
  }

  get innerWidth() {
    return window.innerWidth;
  }

  getComputedStyle(element) {
    return window.getComputedStyle(element);
  }

  getOffsetWidth(elementRef: ElementRef) {
    return elementRef.nativeElement && elementRef.nativeElement.offsetWidth;
  }

  getBoundingClientRect(elementRef: ElementRef) {
    return elementRef.nativeElement && elementRef.nativeElement.getBoundingClientRect();
  }
}

results matching ""

    No results matching ""