How to manage data offline and online in ionic


I am working on blogging app . i want to save article list on SqlLite as well. I need to fetch all blogs in once. ( having more than 2000) blogs .

following is my controller code.

var promise= userService.getArticles();
promise.then(function(data) {
		$scope.articles = data;
}, function(error) {
  console.log('Failed for some reason:' + error);

factory code is

.factory('userService', function($http,$q) {
	var articleList = [];

return {
			getArticles : function() {
				  var deferred = $q.defer();
					url: "",
					data: { starLimit: 0, endLimit: 150,created_date: 0 },
					method: 'POST',
					withCredentials: true,
				}).success(function (data, status, headers, config) {

				}).error(function (err) {
					 deferred.reject(error); //
				 return deferred.promise;

which is returing result.

I need to save that data in sqllite as well. Also i want to show data as offline.

I am not sure how to proceed this. Kindly help.


first of all:
why are you “GETTING” data with a POST request???

and after that --> add sqlite plugin and use the ngCordova wrapper for that: