Call AngularJS function from main electron menu


Hey Guys, I would need some help:

I would like to call a defined function like “removeSelected()” using the “edit > delete” menu item in the main electron menu. Ist there a simple way for doing such things? From inside my main.html I am using simply “ng-click=“removeSelected()””…




have a look at the WebContent Module, esp. contents.executeJavaScript



@sukapx Thanks for taking the time. I was trying this two ways but apparently I am doing something wrong:

    role: 'delete',
	label: 'Delete',
	click (item, focusedWindow) {
      if (focusedWindow) focusedWindow.webContents.executeJavaScript('removeSelected()')
    role: 'delete',
	label: 'Delete',
	click (item, focusedWindow) {
      if (focusedWindow) contents.executeJavaScript('removeSelected()')

Sorry for the ingnorance but I am really a newbie…

Oh, yes this is from my mainmenu.js…


Hm, I’m a bit confused now.

Could you please specify a bit more from where to where you’re calling what code exactly?


I am defining this function im my controller.js file like this:

	$scope.removeSelected = function () {
	var activeObject = canvas.getActiveObject(),
		activeGroup = canvas.getActiveGroup();

	if (activeGroup) {
		var objectsInGroup = activeGroup.getObjects();
		objectsInGroup.forEach(function (object) {
	} else if (activeObject) {

I am calling this function from inside my index.html file if I click a button like this: