How to save and sync remote json data with sqlite


#1

Below is my code AngularJS, I want to store all this data in SQLite and synchronization with the service $ http.jsonp.
For it to work in offline mode.

.controller(‘ActualitesCtrl’, function($scope, $http) {

$scope.actualites = [];
$scope.page=1;
$scope.noMoreItemsAvailable = false;
$scope.loadMore = function() {
$http.jsonp("http://technopark.ma/api/get_recent_posts/?post_type=news&page="+$scope.page+"&callback=JSON_CALLBACK")
   .success(function(data) {
       var i = data.posts.length;
       if(i!=0)

{
$scope.actualites = $scope.actualites.concat(data.posts);
$scope.$broadcast(‘scroll.infiniteScrollComplete’);
$scope.page +=1;
}
else
{
$scope.noMoreItemsAvailable = true;
}
});
};

})

Zak