// 开发环境:Angular5+Electron
// 遇到问题: 在angular5页面中如何获得windows对象
解决如下:
import { Injectable } from '@angular/core';
import * as childProcess from 'child_process';
// add this
import BrowserWindow = Electron.BrowserWindow;
import Shell = Electron.Shell;
@Injectable()
export class ElectronService {
window: BrowserWindow;
this.window = window.require('electron').remote.getCurrentWindow();
.shell = require('electron').shell;
}
文章来源: Electron获取系统windows对象