The app loads up fine, and the initial 'dashboard.html' is injected into ng-view perfectly fine.

The problem comes when I click on an tag to load in another view, such as sites.html, for example. I get a full white screen with no errors output into the console, nor any errors coming from node.js itself.

I'm wondering whether this is a known problem, or whether I've done something wrong in my config.

In the end it certainly seemed to be caused by AngularJS being a bit 'funny' about working correctly only when served by a webserver.

With that in mind, I've implemented an express server on a specific port during the 'create window' phase of my electron app. I then point the window at the localhost URL, which is now technically an express app running inside an electron app, running AngularJS.

It confused me for a while getting the setup in line, but now it seems to be working perfectly and very speedy, too.

EDIT: Here's the code for that!

main.js:

const electron = require('electron');
const server = require("./server");
const sqlite3 = require('sqlite3');
// Module to control application life.
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({width: 1000, height: 700});
// and load the index.html of the app.
//mainWindow.loadURL(`file://${__dirname}/index.html`);
mainWindow.loadURL(`http://localhost:3333`);
// Open the DevTools.
mainWindow.webContents.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null
})
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
});
app.on('activate', function () {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow()
}
});
process.on('uncaughtException', function (err) {
console.log(err);
});
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.