I'm developing an app with Electron and Angular 4. I want to show a dialog when I click a button to select a folder, but there is a problem with the electron API:
I've seen a lot of people with the same problem but I couldn't find a solution to fix this. I've tried to modify the angular-cli config by adding a script that requires the fs module but it fails too...
My component looks like this:
import { Component, OnInit } from '@angular/core';
import { dialog } from 'electron';
@Component({
selector: 'app-photos',
templateUrl: './photos.component.html'
})
export class PhotosComponent implements OnInit {
private path = '';
private photos = ['A', 'B', 'C'];
constructor() { }
ngOnInit() {
}
openFolderSelector() {
dialog.showOpenDialog({ properties: ['openDirectory'] }, (filepaths) => {
console.log(filepaths);
});
}
}
Has anybody made it work?
Thanks for your help!