Added ability to read Transactions from server
This commit is contained in:
parent
00d713fff0
commit
2e27e7a43b
8 changed files with 160 additions and 4 deletions
3
src/app/shared/transaction-result.component.html
Normal file
3
src/app/shared/transaction-result.component.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<td>{{transaction.seller}}</td>
|
||||
<td>{{transaction.value | currency:'GBP':true:'1.2-2' }}</td>
|
||||
<td>{{transactionDate}}</td>
|
21
src/app/shared/transaction-result.component.ts
Normal file
21
src/app/shared/transaction-result.component.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
|
||||
interface TransactionData {
|
||||
seller: number;
|
||||
value: string;
|
||||
purchase_time: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: '[transaction-result]',
|
||||
templateUrl: 'transaction-result.component.html',
|
||||
})
|
||||
export class TransactionResultComponent implements OnInit {
|
||||
@Input() public transaction: TransactionData;
|
||||
public transactionDate: string;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.transactionDate = moment(this.transaction.purchase_time).format('llll');
|
||||
}
|
||||
}
|
Reference in a new issue