angularLocalStorage icon indicating copy to clipboard operation
angularLocalStorage copied to clipboard

Updating local storage

Open rahulchavan30 opened this issue 11 years ago • 1 comments

i have a a question ,when my app is working offline ,when offline i fill out few changes ,how do i sink this data when the user is online ..

can i use $scope.viewType = 'ANYTHING';

will this serve my purpose or shud i explicit write a function to write into a variable and pushing to local storage and then getting the data and updating the my LS..

rahulchavan30 avatar Nov 01 '13 15:11 rahulchavan30

I would suggest adding a middleman service that can record all the different calls the user is trying to make onto an array... so it would be something like {resource_url:"http://xxx.com/add/user",data:{xxx:'aaa'}}. Then run through the array when you detect internet and keep running each query until the array is empty. Of course make sure to store this array in local storage as well... so whenever u detect internet and the array is not empty keep looping and popping the items off the array on success.

agrublev avatar Nov 02 '13 20:11 agrublev