32 lines
862 B
JavaScript
32 lines
862 B
JavaScript
var transactionServices = angular.module('transactionServices', [ 'ngResource' ]);
|
|
|
|
transactionServices.factory('Transaction', [ '$resource', function($resource) {
|
|
return $resource('/transactions/:id', {}, {
|
|
/*query : {
|
|
method : 'GET',
|
|
params : {
|
|
phoneId : 'phones'
|
|
},
|
|
isArray : true
|
|
}*/
|
|
});
|
|
} ]);
|
|
|
|
/*
|
|
// via Resource (might be moved into a service)
|
|
var Transaction = $resource('/transactions');
|
|
|
|
var newTransaction = new Transaction({
|
|
"account" : $scope.account._links.self.href,
|
|
"amount" : amount,
|
|
"date" : $scope.transaction.date,
|
|
"description" : $scope.transaction.description,
|
|
"category" : $scope.transaction.category._links.self.href,
|
|
"creditor" : $scope.transaction.creditor
|
|
});
|
|
|
|
newTransaction.$save(function(transaction) {
|
|
$scope.refreshList();
|
|
$scope.lastSubmission = newTransaction;
|
|
});
|
|
*/ |