resetForm
This commit is contained in:
@@ -6,6 +6,19 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
|
||||
console.log('refreshList()');
|
||||
|
||||
// reset form
|
||||
if ($scope.form) {
|
||||
$scope.form.$setPristine();
|
||||
$scope.form.$setUntouched();
|
||||
}
|
||||
|
||||
$scope.transaction = {
|
||||
amount: 1,
|
||||
date: new Date(),
|
||||
// category: categories._embedded.categories[0]
|
||||
};
|
||||
|
||||
// get recent transactions
|
||||
var transactions = $resource('/transactions/search/last10', { accountId: $scope.accountId }).get();
|
||||
|
||||
transactions.$promise.then(function(data) {
|
||||
@@ -27,7 +40,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
|
||||
console.log('initList()');
|
||||
|
||||
$scope.date = new Date();
|
||||
//$scope.transaction.date = new Date();
|
||||
|
||||
$scope.refreshList();
|
||||
|
||||
@@ -37,7 +50,7 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
$scope.categories = categories._embedded.categories;
|
||||
|
||||
// select the first entry as default
|
||||
$scope.category = categories._embedded.categories[0];
|
||||
$scope.transaction.category = categories._embedded.categories[0];
|
||||
});
|
||||
|
||||
}
|
||||
@@ -49,9 +62,9 @@ transactionControllers.controller('TransactionListCtrl', [ '$scope', '$location'
|
||||
|
||||
var newTransaction = new Transaction({
|
||||
"account" : $scope.account,
|
||||
"amount" : $scope.amount,
|
||||
"date" : $scope.date,
|
||||
"description" : $scope.description,
|
||||
"amount" : $scope.transaction.amount,
|
||||
"date" : $scope.transaction.date,
|
||||
"description" : $scope.transaction.description,
|
||||
"category" : $scope.category._links.self.href,
|
||||
"creditor" : $scope.creditor
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user