Answers for "angular inject window object"

2

nangular make window available

import { Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';

export class MyClass {

  constructor(@Inject(DOCUMENT) private document: Document) {
     this.window = this.document.defaultView;
  }

  check() {
    console.log(this.document);
    console.log(this.window);
  }

}
Posted by: Guest on June-24-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language