angularLocalStorage
angularLocalStorage copied to clipboard
Updating local storage
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..
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.