Fix account save.

This commit is contained in:
Alexis Lahouze 2016-04-12 10:46:08 +02:00
parent 729a061d02
commit 94f5b53206
2 changed files with 6 additions and 4 deletions

View File

@ -119,14 +119,16 @@ angular.module('accountant.accounts', [
/*
* Save account.
*/
$scope.save = function($data, $index) {
var account = $scope.accounts[$index];
$scope.save = function(account) {
//var account = $scope.accounts[$index];
account = angular.merge(account, $data);
//account = angular.merge(account, $data);
return account.$save().then(function(data) {
Notification.success('Account #' + data.id + ' saved.');
// TODO Alexis Lahouze 2016-03-08 Update solds
return data;
});
};

View File

@ -70,7 +70,7 @@
<td>
<form editable-form name="rowform"
onbeforesave="save($data, $index)" shown="!account.id">
onaftersave="save(account)" shown="!account.id">
<div class="btn-group btn-group-xs">
<!-- Edit account. -->
<button type="button" class="btn btn-success"