📜  角度窗口对象 - Javascript 代码示例

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

代码示例2
// in app.module.ts
providers: [
{ provide: Window, useValue: window }
]

// in component: 
Then you can just inject it directly anywhere you want - e.g. in a service:

constructor(private window: Window) {
// ...