From bb21dd700ea56e62dd87f74448a9d2f207811cc8 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sat, 29 Jul 2017 22:53:41 +0200 Subject: [PATCH] Use Account Id service instead of $stateParam. --- src/operations/operation.controller.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/operations/operation.controller.ts b/src/operations/operation.controller.ts index 4b4bce1..818203c 100644 --- a/src/operations/operation.controller.ts +++ b/src/operations/operation.controller.ts @@ -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 }); };