Saving properties in ionic db

I am not seeing properties of my typescript object being saved in ionic db. I created a property with a getter and setter and it doesn’t get persisted. Regular properties without getters and setters work fine.

Anyone know if this will get addressed in ionic db?

This has nothing to do with Ionic db, and everything to do with how javascript works. Ionic db stores JSON, JSON can not contain functions. You can though create toJSON and fromJSON methods on your class to define how objects are serialized and deserialized.

1 Like