Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How to manage data offline and online in ionic

$
0
0

Hello

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

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


return {

			getArticles : function() {
				  var deferred = $q.defer();
				$http({
					url: "https://www.website.com/getallinfo?access_token=94529e5d",
					data: { starLimit: 0, endLimit: 150,created_date: 0 },
					method: 'POST',
					withCredentials: true,
				}).success(function (data, status, headers, config) {
						 deferred.resolve(data);


				}).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.

Thanks


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>