Use Account Id service instead of $stateParam.

This commit is contained in:
Alexis Lahouze 2017-07-29 22:53:41 +02:00
parent 0a5a7e72e3
commit bb21dd700e

View File

@ -9,7 +9,8 @@ import { Operation } from './operation';
import { OperationService } from './operation.service';
module.exports = function(
$stateParams, $modal,
$modal,
accountIdService,
toastrService: ToastrService,
operationService: OperationService,
AccountService
@ -21,7 +22,7 @@ module.exports = function(
*/
vm.add = function() {
var operation = new Operation();
operation.account_id = $stateParams.accountId;
operation.account_id = accountIdService.get();
return vm.modify(operation);
};
@ -34,7 +35,7 @@ module.exports = function(
vm.maxDate = maxDate;
return operationService.query(
$stateParams.accountId,
accountIdService.get(),
minDate,
maxDate
).subscribe((operations: Operation[]) => {
@ -162,7 +163,7 @@ module.exports = function(
vm.load(dateRange.minDate, dateRange.maxDate);
};
AccountService.get($stateParams.accountId).subscribe(account => {
AccountService.get(accountIdService.get()).subscribe(account => {
vm.account = account
});
};