Upgrade routing to Angular2.
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
// vim: set tw=80 ts=2 sw=2 sts=2 :
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
import { Logger } from '@nsalaun/ng-logger';
|
||||
@ -71,16 +73,18 @@ export class OperationListComponent implements OnInit {
|
||||
private operations: Operation[];
|
||||
|
||||
constructor(
|
||||
@Inject("accountIdService") private accountIdService,
|
||||
private toastrService: ToastrService,
|
||||
private operationService: OperationService,
|
||||
private accountService: AccountService,
|
||||
private logger: Logger,
|
||||
private ngbModal: NgbModal,
|
||||
private route: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.accountService.get(this.accountIdService.get()).subscribe(account => {
|
||||
this.accountService.get(
|
||||
+this.route.snapshot.paramMap.get('accountId')
|
||||
).subscribe(account => {
|
||||
this.account = account
|
||||
});
|
||||
}
|
||||
@ -90,7 +94,7 @@ export class OperationListComponent implements OnInit {
|
||||
*/
|
||||
add() {
|
||||
var operation = new Operation();
|
||||
operation.account_id = this.accountIdService.get();
|
||||
operation.account_id = this.account.id;
|
||||
|
||||
// FIXME Alexis Lahouze 2017-06-15 i18n
|
||||
const modal = this.ngbModal.open(OperationEditModalComponent);
|
||||
@ -111,7 +115,7 @@ export class OperationListComponent implements OnInit {
|
||||
this.maxDate = maxDate;
|
||||
|
||||
return this.operationService.query(
|
||||
this.accountIdService.get(),
|
||||
this.account.id,
|
||||
minDate,
|
||||
maxDate
|
||||
).subscribe((operations: Operation[]) => {
|
||||
|
Reference in New Issue
Block a user