Skip to content

Commit d2a058d

Browse files
Updated the ReadMe content
1 parent b331dab commit d2a058d

2 files changed

Lines changed: 72 additions & 16 deletions

File tree

README.md

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,83 @@
1-
# Sample15
1+
# Integrating Syncfusion Angular Components with Angular and Electron Applications
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.4.
3+
This document helps you to create a simple Angular application with `Electron Framework` and `Syncfusion Angular UI components`.
44

5-
## Development server
5+
## Prerequisites
66

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
7+
Before getting started with the Angular project, make sure you have the following installed on your machine,
88

9-
## Code scaffolding
9+
* [System requirements for Syncfusion Angular UI components](https://ej2.syncfusion.com/angular/documentation/system-requirement)
10+
* Electron CLI version - `^22.x.x` or later
1011

11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12+
If you do not have the `Electron CLI` installed, refer to the [`Electron package`](https://www.npmjs.com/package/electron-cli) for instructions on how to install it.
1213

13-
## Build
14+
## Getting started with Syncfusion Angular component
1415

15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
16+
Follow the [documentation](https://ej2.syncfusion.com/angular/documentation/getting-started/angular-cli) to create an Angular application that includes Syncfusion Angular components.
1617

17-
## Running unit tests
18+
## Create main.js file
1819

19-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20+
Create a `main.js` file in the root folder of the project and update the below code, This file will serve as an entry-point for Electron and it is responsible for creating windows and handling all the system events that might occur in the app.
2021

21-
## Running end-to-end tests
22+
```typescript
23+
const { app, BrowserWindow } = require('electron');
24+
let win;
2225

23-
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
26+
function createWindow() {
27+
win = new BrowserWindow({ width: 800, height: 600 });
2428

25-
## Further help
29+
// Load the Angular app in the browser window
30+
win.loadFile('./dist/sample15/index.html');
2631

27-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
32+
win.on('closed', () => {
33+
win = null;
34+
});
35+
}
36+
37+
app.on('ready', createWindow);
38+
39+
app.on('window-all-closed', () => {
40+
if (process.platform !== 'darwin') {
41+
app.quit();
42+
}
43+
});
44+
45+
app.on('activate', () => {
46+
if (win === null) {
47+
createWindow();
48+
}
49+
});
50+
51+
```
52+
53+
## Update index.html
54+
55+
In the `/src/index.html` file, change `<base href="/">` to `<base href="./">`, so that the Electron can able to find the Angular files.
56+
57+
## Update package.json
58+
59+
Go to your root directory and find the package.json file. Open its content and add the following,
60+
61+
```typescript
62+
"main":"main.js",
63+
"scripts": {
64+
"ng": "ng",
65+
"start": "ng serve",
66+
"build": "ng build",
67+
"test": "ng test",
68+
"lint": "ng lint",
69+
"e2e": "ng e2e",
70+
"electron-build": "ng build --configuration=production",
71+
"electron": "electron ."
72+
},
73+
```
74+
75+
## Running the application
76+
77+
Finally, run the following command line to start the application. The Syncfusion Essential JS 2 menu component will be rendered in the Electron framework.
78+
79+
```bash
80+
npm run electron-build
81+
82+
npm run electron
83+
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"@angular/platform-browser": "^15.1.0",
2222
"@angular/platform-browser-dynamic": "^15.1.0",
2323
"@angular/router": "^15.1.0",
24-
"@syncfusion/ej2-angular-grids": "^20.4.48",
25-
"@syncfusion/ej2-material-theme": "~20.4.48",
24+
"@syncfusion/ej2-angular-grids": "*",
25+
"@syncfusion/ej2-material-theme": "*",
2626
"electron": "^22.2.0",
2727
"rxjs": "~7.8.0",
2828
"tslib": "^2.3.0",

0 commit comments

Comments
 (0)