hye huys, i need help for delete and update using pouchdb. for the now create and read data can work. just delete and update not work yet. this is my database
application.service('Database', ['$q', '$window',
function($q, $window)
{
var db = new $window.PouchDB('web-sample');
this.delete = function(documentId, documentRev, options)
{
return $q.when(db.delete(documentId, documentRev, options));
};
this.get = function(documentId)
{
return $q.when(db.get(documentId));
};
}
]);
and this is my service
application.service('Arrears', ['$q', 'Database',
function($q, Database)
{
this.remove = function(documentId, documentRev, options)
{
return Database.delete(documentId, documentRev, options);
};
this.update = function()
{
return Database.update()
};
}
]);
this is my controller.
application.controller('ArrearsManagementReadAllController', ['$location', '$mdSidenav', '$routeParams', '$scope', 'arrears',
function($location, $mdSidenav, $routeParams, $scope, arrears)
{
$scope.arrears = arrears;
$scope.remove = function(id)
{
$location.path('/arrears_management/all');
};
var arrears = {
owner_name: '',
owner_id: '',
account_no: '',
title_no: '',
address: '',
house_no: '',
floor: '',
lot: '',
block: '',
locality: '',
total_outstanding: '',
last_receipt_no: '',
last_pay_date: '',
last_paid_amount: '',
};
var actions = {};
actions.submit = function(arrears)
{
Arrears.update(arrears).
then(function(response)
{
$location.path('/arrears_management/all');
});
};
}]);
if you all know how to solve my problems please comment. thanks