Reputation: 2631
I'm building an AngularJS application wrapped with Cordova for Android and iOS. All my datas come from my rest API.
I have urls like my.api/groups/1/items
to get the list of items
[
{
id: 5,
type: "foo",
title: "Item 5",
group: 1,
body: "<p>Some content</p> ",
img: "http://my.website/images/item5.jpg"
},
{
id: 6,
...
}
]
and my.api/items/5
to get a specific item
{
id: 5,
type: "foo",
title: "Item 5",
group: 1,
body: "<p>Some content</p> ",
img: "http://my.website/images/item5.jpg"
}
I retrieve my datas with restangular and it works perfectly
Restangular.one('group', id).getList('items').then(function(data){
$scope.items = data;
});
Now I want that datas be available offline and refreshed time to time. Localstorage is not possible because I ll have +5MB of datas and images.
I see a lot of posts about file API but does it mean I need to have a file for each item? eg: item1.json, item2.json and a file for the list items.json I think there is a better solution than having 500+ different files...
How to handle images? Do I need to parse my api, download images and replace with local links?
Upvotes: 0
Views: 642
Reputation: 10857
Why not use WebSQL? As a web standard, it is dead, but it works well on mobile and works great in PhoneGap/Cordova. As for images, I'd probably store them as binary though on the file system.
Upvotes: 1