Nodonisko / ionic-cache

Angular cache service with IndexedDB, SQLite and WebSQL support
MIT License
262 stars 74 forks source link

no such key #40

Closed watermelon-brother closed 6 years ago

watermelon-brother commented 7 years ago

hi! I use the function which is the loadFromObservable in ionic3.it cause a error when run. error: Uncaught (in promise): No such key: http://ip.jsontest.com

my function(it's your demo,why?) loadList() { let url = "http://ip.jsontest.com"; let cacheKey = url; let request = this.http.get(url).map(res => res.json());

return this.cache.loadFromObservable(cacheKey, request);

}

Nodonisko commented 7 years ago

It's definitely bug, can you provide information about browser you use, device etc.?

watermelon-brother commented 7 years ago

now!everything is ok! the tools is very good!think you! hope you can keep update with the ionic !@Nodonisko

Alberick commented 7 years ago

I get this when there's nothing on the cache, I have a calendar page and when I load it, inside my ionViewDidLoad I call my api service which retrieves all the events that's when I get the 'no such key'

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.8
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.1.2
Ionic Framework                 : ionic-angular 3.4.2

System:

Node       : v6.10.3
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 3.10.10
watermelon-brother commented 7 years ago

you can use like this this.cache.loadFromObservable(cacheKey, request).subscribe(); @Alberick0

D4rkMindz commented 7 years ago

Same problem here. If the cache-item is empty, there is the message, that there is no key.

harsandevhunt commented 7 years ago

Have to use like this below to overcome this issue,

loadList() { let url = "http://ip.jsontest.com"; let request = this.http.get(url);

return this.cache.loadFromObservable(url, request).subscribe((res:Response) => {res.json()});

D4rkMindz commented 7 years ago

try to replace subscript with subscribe