added refresh timer to latest transactions; styled latest transactions grid
This commit is contained in:
parent
9848b17fc1
commit
07cd0cbd8f
@ -12,10 +12,12 @@
|
|||||||
</ion-row>
|
</ion-row>
|
||||||
|
|
||||||
<ion-row *ngFor="let tx of transactions">
|
<ion-row *ngFor="let tx of transactions">
|
||||||
<ion-col>
|
<ion-col col-9>
|
||||||
<a (click)="goToTx(tx.txid)">{{ tx.txid }}</a>
|
<div class="ellipsis">
|
||||||
|
<a (click)="goToTx(tx.txid)">{{ tx.txid }}</a>
|
||||||
|
</div>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
<ion-col text-right>
|
<ion-col col-3 text-right>
|
||||||
{{ currency.getConversion(tx.valueOut) }}
|
{{ currency.getConversion(tx.valueOut) }}
|
||||||
</ion-col>
|
</ion-col>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
|||||||
@ -1,3 +1,23 @@
|
|||||||
latest-transactions {
|
latest-transactions {
|
||||||
|
ion-grid {
|
||||||
|
// border: 2px solid green;
|
||||||
|
margin: 10px 0 20px;
|
||||||
|
|
||||||
|
ion-row {
|
||||||
|
border-top: 1px solid #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-row:nth-child(even) {
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-row:first-child {
|
||||||
|
background-color: white;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
ion-row:last-child {
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, NgZone } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { NavController } from 'ionic-angular';
|
import { NavController } from 'ionic-angular';
|
||||||
import { ApiProvider } from '../../providers/api/api';
|
import { ApiProvider } from '../../providers/api/api';
|
||||||
@ -19,14 +19,26 @@ export class LatestTransactionsComponent {
|
|||||||
private loading: boolean = true;
|
private loading: boolean = true;
|
||||||
private transactions: Array<any> = [];
|
private transactions: Array<any> = [];
|
||||||
|
|
||||||
constructor(private http: Http, private navCtrl: NavController, private api: ApiProvider, public currency: CurrencyProvider) {
|
constructor(private http: Http, private navCtrl: NavController, private api: ApiProvider, public currency: CurrencyProvider, ngZone: NgZone) {
|
||||||
|
this.loadTransactions();
|
||||||
|
ngZone.runOutsideAngular(() => {
|
||||||
|
setInterval(
|
||||||
|
function (): void {
|
||||||
|
ngZone.run(function (): void {
|
||||||
|
this.loadTransactions.call(this);
|
||||||
|
}.bind(this));
|
||||||
|
}.bind(this),
|
||||||
|
1000 * 10
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadTransactions(): void {
|
||||||
let url: string = this.api.apiPrefix + 'txs';
|
let url: string = this.api.apiPrefix + 'txs';
|
||||||
|
|
||||||
this.http.get(url).subscribe(
|
this.http.get(url).subscribe(
|
||||||
(data) => {
|
(data) => {
|
||||||
this.transactions = JSON.parse(data['_body']);
|
this.transactions = JSON.parse(data['_body']);
|
||||||
console.log('this.transactions', this.transactions);
|
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user