fixed transaction submission
This commit is contained in:
@@ -58,18 +58,13 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.refreshAccount = function() {
|
|
||||||
console.log('BINGO!');
|
|
||||||
$scope.refreshList();
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.postTransaction = function() {
|
$scope.postTransaction = function() {
|
||||||
|
|
||||||
// via Resource (might be moved into a service)
|
// via Resource (might be moved into a service)
|
||||||
var Transaction = $resource('/transactions');
|
var Transaction = $resource('/transactions');
|
||||||
|
|
||||||
var newTransaction = new Transaction({
|
var newTransaction = new Transaction({
|
||||||
"account" : $scope.account,
|
"account" : $scope.account._links.self.href,
|
||||||
"amount" : $scope.transaction.amount,
|
"amount" : $scope.transaction.amount,
|
||||||
"date" : $scope.transaction.date,
|
"date" : $scope.transaction.date,
|
||||||
"description" : $scope.transaction.description,
|
"description" : $scope.transaction.description,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<div><select ng-model='account' ng-change='refreshAccount()' ng-options="account.name for account in accounts track by account.id"></select></div>
|
<div><select ng-model='account' ng-change='refreshList()' ng-options="account.name for account in accounts track by account.id"></select></div>
|
||||||
<div>
|
<div>
|
||||||
<form role="form" ng-submit="postTransaction()">
|
<form role="form" ng-submit="postTransaction()">
|
||||||
<div>
|
<div>
|
||||||
Betrag: <input ng-model='transaction.amount' type='number' />
|
Betrag: <input ng-model='transaction.amount' type='number' step='0.01' />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
Kategorie: <select ng-model='transaction.category' size='1'
|
Kategorie: <select ng-model='transaction.category' size='1'
|
||||||
@@ -36,11 +36,11 @@
|
|||||||
<td>{{transaction.description}}</td>
|
<td>{{transaction.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div>
|
|
||||||
<pre style="font-size: 75%; color: darkgray;">{{accounts | json}}</pre>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<!-- div>
|
||||||
|
<pre style="font-size: 75%; color: darkgray;">{{account | json}}</pre>
|
||||||
|
</div -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user