Is there a library for model handling for javascript/angular/ionic and cordova?


#1

Hello,

in my ionic (angular)/cordova app I need to store model data persistently. Now I debug on my computer (in the browser) and on the device. Therefor I use the cordova sqlite plugin https://github.com/litehelpers/Cordova-sqlite-storage.

To my knowledge cordova plugins don’t work in the browser. That’s why I built a “store structure”. A store holds instances of a certain type (e.g. Books). By using a method like getById() I can retrieve a certain book. On the device this is done via a “SELECT”-Statement using the cordova sqlite plugin. On my computer this is done by accessing a javascript object (dummy data). Basically a kind of middleware or an ORM.

So in my code I just want to write “BookStore.getById()” and in the browser this is resolved with simple javascript objects (or even sqlite in the browser) and on the device using cordova sqlite plugin.

The whole construct works but I’m not really happy with it so I’m asking this question here:

Is there any angular/javascript extension which encapsulates the cordova sqlite plugin (or something else) in a manner I did and is quite bullet proof?

Or maybe there is another solution for my problem?

Thanks in advance.