📜  nangular 使窗口可用 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:29.993000             🧑  作者: Mango

代码示例1
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);
  }

}