@refle wrote:
Hi,
I have a storage set upimport { Storage } from '@ionic/storage'; export class HomePage { ... constructor(private storage: Storage, ...){...} set_fun(foo){ this.storage.set(`test`, foo); } }
The foo object, which has a method “get_name()” is stored, but when I try in another page to call
this.storage.get('test').then((val) => { this.testvar = val.get_name(); });
I get the error:
Uncaught (in promise). Type Error. val.get_name() is not a functionObviously the get function does not know that val is a foo-type object. How do I deal with that?
(Using ionic 3)
Posts: 1
Participants: 1