I have function in which I want to return an Observable as my query result. I am making a SQLite Query and I want to return the result in an Observable. I tried putting the Observable.of outside at the first Promise function but it did not work. This is my code.
GetCustomers(FilterOptions: any): Observable<any> {
return Observable.of(this.platform.ready().then(() => { //WRONG CODE
this.SQLObj.executeSql("select * from customers, {}).then((res) => {
console.log(res);
});
})).map(cust => {
// MODIFY THE RESULT AND CREATE NEW OBJECT.
return JSON.stringify(cust);
})
}
Basically I want to return an Observable with nested promises but before that I want to modify and customize the resulted data of the SQL Query. What is the best way to do it.