angularjs - Saving and Getting Data / Rows to and from PouchDB -
i new pouchdb, meaning have not yet been able implement app uses it.
this issue now, in controller have 2 functions:
var init = function() { vm.getinvoicesremote(); // data server , update pouchdb vm.getinvoiceslocal(); // data pouchdb , load in view } init(); basically in app have view shows customer invoices, want customers able still see invoices when they're offline. have seen several examples of pouchdb , couchdb use "todo" example not give information.
now i'm confused point in me spending hours understanding couchdb , installing if in end i'm going retrieving data server using api.
also when data returned how pouchdb identify records new , records old when appending.
well, m working on same kind..!this how m making work..!
$scope.lists = function () { if(!$rootscope.connectionflag){ offlineservice.getlocalorderslist(function (locallist) { if(locallist.length > 0) { $scope.list = locallist; } }); }else{ if(!$scope.user){ }else { common.callapi("post", '***/*************', $scope.listparams, function (data) { if (data !== null) { $scope.list = data.result; offlineservice.bulkordersadd_updatelocaldb($scope.list); } }); } } }; so,$scope.list filled if online offline based on connectionflag
note : offlineservice , common services.
call method:
$ionicplatform.ready(function () { offlineservice.configdbscallback(function(res) { if(res) { $scope.lists(); } }); }); u can try calling $scope.lists(); directly..! hope helps u..!
Comments
Post a Comment