setting.component.ts
import { Component, OnInit } from '@angular/core';
import { ElectronService } from 'ngx-electron';
@Component({
selector: 'app-setting',
templateUrl: './setting.component.html',
styleUrls: ['./setting.component.css']
})
export class SettingComponent implements OnInit {
private primaryServer: string;
private secondaryServer: string;
constructor(
private electron: ElectronService
) { }
ngOnInit() {
this.electron.ipcRenderer.send("asynchronous-message", {get: "settings"})
this.electron.ipcRenderer.on("asynchronous-reply", (event, data) => {
this.primaryServer = data.database.primary;
this.secondaryServer = data.database.secondary;
})
}
}
setting.component.html
<p>{{primaryServer}}</p>
<p>{{secondaryServer}}</p>
My "primaryServer" and "secondaryServer" values do not show up when the page loads. however, when I click on the input or a random button for it, it shows up. How do I get them to show up on init?