C of CRUD
This commit is contained in:
@@ -14,19 +14,16 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
for (var i = 0; i < $scope.transactions.length; i++) {
|
||||
$scope.transactions[i].category = $resource($scope.transactions[i]._links.category.href).get();
|
||||
$scope.transactions[i].creditor = $resource($scope.transactions[i]._links.creditor.href).get();
|
||||
// $scope.transactions[i].account = $resource($scope.transactions[i]._links.account.href).get();
|
||||
}
|
||||
|
||||
// XXX get selected account from frontend
|
||||
$scope.account = $scope.transactions[0]._links.account;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$scope.initList = function() {
|
||||
|
||||
// TODO pass accountId
|
||||
// TODO get account from frontend
|
||||
$scope.accountId = 1;
|
||||
$scope.account = 'http://localhost:8080/accounts/1';
|
||||
|
||||
console.log('initList()');
|
||||
|
||||
@@ -63,15 +60,22 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
"amount" : $scope.amount,
|
||||
"date" : $scope.date,
|
||||
"description" : $scope.description,
|
||||
"category" : $scope.category,
|
||||
"category" : $scope.category._links.self.href,
|
||||
"creditor" : $scope.creditor
|
||||
});
|
||||
|
||||
console.log(newTransaction);
|
||||
|
||||
newTransaction.$save();
|
||||
// create copy of transaction object
|
||||
var newTransactionCopy = (JSON.parse(JSON.stringify(newTransaction)));
|
||||
|
||||
$scope.newTransaction = newTransaction;
|
||||
$scope.newTransactionCopy = newTransactionCopy;
|
||||
|
||||
newTransaction.$save(function(transaction, putResponseHeaders) {
|
||||
$scope.refreshList();
|
||||
});
|
||||
|
||||
$scope.refreshList();
|
||||
};
|
||||
|
||||
$scope.showTransaction = function(transaction) {
|
||||
|
||||
Reference in New Issue
Block a user