aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+accounts/accounts.component.ts
blob: 1298803c39a4c02c6e514876335cc8a7bcc2b952 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AccountService } from '@app/shared/account/account.service'
import { Account } from '@app/shared/account/account.model'

@Component({
  templateUrl: './accounts.component.html',
  styleUrls: [ './accounts.component.scss' ]
})
export class AccountsComponent implements OnInit {
  account: Account

  constructor (
    private route: ActivatedRoute,
    private accountService: AccountService
  ) {}

  ngOnInit () {
    const accountId = parseInt(this.route.snapshot.params['accountId'], 10)

    this.accountService.getAccount(accountId)
        .subscribe(account => this.account = account)
  }
}