Correction Transaction test

Affichage de l'historique de transaction avec quelques variables de test
This commit is contained in:
GME 2018-11-08 09:58:09 +01:00
parent 3e907cf5f2
commit bcd5d2330a
3 changed files with 20 additions and 3 deletions

View file

@ -3,4 +3,5 @@ export class Transaction {
to: string
amount: number
timestamp: number
date: string
}

View file

@ -18,7 +18,13 @@
<ion-item *ngFor="let transactionTest of listTransactions">
<ion-card>
<ion-card-content>
{{transactionTest}}
From : {{transactionTest.from}}
<br>
To : {{transactionTest.to}}
<br>
Amount : {{transactionTest.amount}}
<br>
Date : {{transactionTest.date}}
</ion-card-content>
</ion-card>
</ion-item>

View file

@ -15,8 +15,9 @@ import {Transaction} from "../../app/models/Transaction";
templateUrl: 'transactions.html',
})
export class TransactionsPage {
listTransactions:Array<Transaction>;
transactionTest:Transaction;
listTransactions = [];
transactionTest = new Transaction();
transactionTest2 = new Transaction();
constructor(public navCtrl: NavController, public navParams: NavParams) {
@ -32,9 +33,18 @@ export class TransactionsPage {
this.transactionTest.to="tata";
this.transactionTest.amount=200;
this.transactionTest.timestamp=1539600000;
this.transactionTest.date= new Date(this.transactionTest.timestamp*1000).toDateString()
this.listTransactions.push(this.transactionTest);
this.transactionTest2.from="tata";
this.transactionTest2.to="toto";
this.transactionTest2.amount=40;
this.transactionTest2.timestamp=1539900000;
this.transactionTest2.date= new Date(this.transactionTest2.timestamp*1000).toDateString()
this.listTransactions.push(this.transactionTest2);
}
}