AngularJS 1.5+ module to save form data to the browser or device storage when there is no connectivity or a server error
npm i @blinkmobile/angularjs-pending-queue
dist/bm-angularjs-pending-queue.min.jsin your HTML or in your build step
bmPendingQueueas a dependency to your AngularJS web app
require('path/to/dist/bm-angularjs-pending-queue.min.js') angular.module('myModule', ['bmPendingQueue'])
pendingQueueList- Component that displays the items saved in the pending queue
bmPendingQueueService- Service that wraps LocalForage to save data to the device in a specific format. Broadcasts events on
dbName- Constant. The name of the device storage db being used
pendingQueueTable- Constant. The name of the table in the db
How it works
AngularJS Pending Queue works by injecting a HTTP Interceptor into the interceptors array. If a
PUT request with a Content Type header of
application/json errors, the request and response data is saved to the device storage using LocalForage. If a previously saved item is successfully sent, the corresponding entry in device storage is removed.
There is a decorator for the
$http service, to automate resending of items in the pending queue. Any successful HTTP request will trigger resending of any items in the pending queue.
See the docs folder for more details