I'm currently utilizing an API known as ngx-pwa localstorage, which serves as a wrapper for an indexeddb database. Within my Angular project, I have a service that interacts with this database through a method called getItem:
getItem(key: string) {
var data;
this.storage.get(key).subscribe((dataPassed) => {
console.log("data passed was", dataPassed);
console.log("typeof ", typeof(dataPassed));
console.log("data is?");
data = dataPassed as string;
});
return data;
}
When calling this method within my Angular component, no data is returned despite finding the item in the subscribe method.
loadData(key) {
console.log("storage from loaddb", this.storage.getItem(key)); // nothing is returned
}
Is there any way to successfully retrieve this data?