On Ionic 4 Angular 8 project, I try to get information in storage before call API.
Here is my code
public getData(id) {
return this.storage.get(id).then(
content => {
if (content == null) {
return this.getObject(id).subscribe(
result => {
return result;
}
);
} else {
return content;
}
}
);
}
How can I call the function 'getData ?
myService.getData(id).then
This return string or observable I should subscribe, how to handle both cases ?