Angular-cli doesn't accept the electron inside components. how to use electron browser window inside components in angular-cli? I got an error fs.existsync like this. Is there any other options to use electron with angular2 components?
var electron = require('electron');
or
import electron from 'electron';
Both are not working inside ts?
You can only do this by initialize electron variables inside index.html and you can communicate wherever you want inside typescript. Use electron variables inside TS.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-2.1.1.js"></script>
<title>Workdesk 2.0</title>
<!--<base href="./">-->
<base href="./">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles.css">
<script src="assets/jquery.js"></script>
</head>
<body style="margin: 0px;">
<app-root> </app-root>
<script>
var electron = require('electron');
var BrowserWindow = require('electron').remote.BrowserWindow;
var ipcMain = require('electron').remote.ipcMain;
var shell = require('electron').shell;
var Positioner = require('electron-positioner');
var path = require('path');
var gkm = require('gkm');
var fs = require('fs');
var os = require('os');
var path = require('path');
var base64Img = require('base64-img');
var ip = require('ip');
</script>
</body>
</html>
This will help you to communicate with electron in any of the script languages like angular2,react js, node js etc.,