I have a working method that functions as intended:
getdata(): Promise<any> {
let query = `SELECT * FROM table`;
return new Promise((resolve, reject) => {
this.db.query(query, (error, rows) => {
if(error) reject(error);
resolve(rows);
});
});
}
ngOnInit() {
this.myservice.getdata().then(result => {
this.data = result;
})
}
I'm currently using Angular 9 along with Electron.
Is there a way I can modify this to operate as an Observable instead?