角和电子通讯

时间:2019-06-19 16:52:35

标签: angular electron angular7

我试图将我的角度应用程序与电子集成在一起,并希望将信息从电子绑定并发送到角度。我的代码如下:

"dependencies": {
    "@angular/animations": "^5.2.11",
    "@angular/common": "^5.2.11",
    "@angular/compiler": "^5.2.11",
    "@angular/core": "^5.2.11",
    "@angular/forms": "^5.2.11",
    "@angular/http": "^5.2.11",
    "@angular/platform-browser": "^5.2.11",
    "@angular/platform-browser-dynamic": "^5.2.11",
    "@angular/router": "^5.2.11",
    "angular-file-saver": "^1.1.3",
    "angular-webstorage-service": "^1.0.2",
    "core-js": "^2.6.9",
    "file-saver": "^2.0.2",
    "jquery": "^3.4.1",
    "moment": "^2.24.0",
    "ngx-bootstrap": "^2.0.5",
    "ngx-select-dropdown": "^1.0.1",
    "ngx-select-ex": "^3.6.10",
    "ngx-select-options": "^1.0.5",
    "rxjs": "^5.5.12",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.29"

我的模型类如下:

App.module.ts:

import { NgxElectronModule } from 'ngx-electron';

@NgModule({
  ...
  imports: [
    BrowserModule,
    NgxElectronModule   // Add it here
  ],
  ...
})
export class AppModule { }


AppComponent.ts:

import { Component } from '@angular/core';
import { ElectronService } from 'ngx-electron';

export class AppComponent {

  constructor(private _electronService: ElectronService) {}   // DI



}

如何将模型类中的内容从Angular发送到电子

这可能是一个重复的问题,但是我是新手,因此需要详细的说明以更好地理解

1 个答案:

答案 0 :(得分:0)

好吧,我使用Electronserice提供的可用IpcRenderer和IpcMain方法做到了