I am completely new to Ionic 2, heard about it just a week ago. So I read around on Ionic and created a few sample apps also by following some online videos. It is indeed a great way to cut the efforts of developing multi-platform application(s) by at least half.
Then I heard about Electron and was able to embed some Angular 2 applications into Electron to get a Desktop version of those applications. Works great!
Next I wanted to try embedding an Ionic 2 app into Electron. I am sure I am not doing some setting somewhere right. I mean I get the main HTML I have for Ionic but it only shows the Title of the HTML in my Electron Desktop application window title bar. It doesnāt load the actual Ionic 2 app. The ionic app doesnāt really have much just a few different components are getting displayed. I also tried it with simple default Ionic 2 app that gets created with the command āionic start myionic2app --v2ā, this also did not work.
I would highly appreciate if somebody can please guide me in the right direction or give some pointers on how to do this.
Then I copied the main.js and renderer.js from the Electron quick start folder and pasted into the new Ionic2 folder.
Then in the main.js I changed the pathname to:
path.join(__dirname, āwww/index.htmlā),
The ran ionic serve - this creates the contents of the www folder including the index.
Then open a new terminal and ran:
npm install && npm start
While this worked for me and I had a desktop app running with my Ionic2 app inside, I have not yet been able to get the ipc communications working from the Ionic side to the main process running in Electron.
If anyone knows how to get that working - I would love to hear about it. @gauz09: You mentioned you had angular2 workingā¦ did you try ipc?
Were you able to package your ionic-electron app using electron-builder perchance? Iāve tried but have been unsuccessful Iām able to build my app on my mac but once I click on the app icon only the electron app runs giving me a blank screen.
I do notice that if I run $ > ionic serve before I clicked on the app icon everything seems to run fine.
Yes. I did not go far with it yet but it did work.
Iām able to access my files right now but I think that repo was a good start. Sorry cannot confirm right now.
I tried this a couple of weeks ago and had it working. Still not quite as streamlined as Iād like it but certainly working and 95% of the way there:
When I find time to finish it up to something more polished I will, but that should be pretty easy to follow (I wrote it moreso as notes for myself to follow again later).
Thanks Rob for the tutorial. I had my application built for desktop following your tutorial but the icon coming is the default electron icon. Will you be able to help and guide how to update my application icon instead of default icon in the package.