Added TransactionsComponent
This commit is contained in:
parent
de09b9056d
commit
6f99a2f881
3
app/src/components/transactions/transactions.html
Normal file
3
app/src/components/transactions/transactions.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<div>
|
||||||
|
Put Transactions here
|
||||||
|
</div>
|
||||||
16
app/src/components/transactions/transactions.module.ts
Normal file
16
app/src/components/transactions/transactions.module.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { IonicModule } from 'ionic-angular';
|
||||||
|
import { TransactionsComponent } from './transactions';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
TransactionsComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
IonicModule
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
TransactionsComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class TransactionsComponentModule {}
|
||||||
3
app/src/components/transactions/transactions.scss
Normal file
3
app/src/components/transactions/transactions.scss
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
transactions {
|
||||||
|
|
||||||
|
}
|
||||||
38
app/src/components/transactions/transactions.ts
Normal file
38
app/src/components/transactions/transactions.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { Input } from '@angular/core';
|
||||||
|
import { Http } from '@angular/http';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generated class for the TransactionsComponent component.
|
||||||
|
*
|
||||||
|
* See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html
|
||||||
|
* for more info on Angular Components.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'transactions',
|
||||||
|
templateUrl: 'transactions.html'
|
||||||
|
})
|
||||||
|
export class TransactionsComponent {
|
||||||
|
|
||||||
|
public loading: boolean = true;
|
||||||
|
@Input() private blockHash: string;
|
||||||
|
public transactions: any = [];
|
||||||
|
|
||||||
|
constructor(private http: Http) {
|
||||||
|
let apiPrefix: string = 'http://localhost:3001/insight-api/';
|
||||||
|
|
||||||
|
this.http.get(apiPrefix + 'txs/' + this.blockHash).subscribe(
|
||||||
|
(data) => {
|
||||||
|
console.log('hey, got data');
|
||||||
|
this.transactions = JSON.parse(data['_body']);
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.log('err is', err);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -33,6 +33,7 @@
|
|||||||
<p>Next Block <a (click)="goToNextBlock()">{{ block.height + 1 }}</a></p>
|
<p>Next Block <a (click)="goToNextBlock()">{{ block.height + 1 }}</a></p>
|
||||||
|
|
||||||
<h3>Transactions</h3>
|
<h3>Transactions</h3>
|
||||||
|
<transactions blockHash="block.hash"></transactions>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="loading">
|
<div *ngIf="loading">
|
||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { IonicPageModule } from 'ionic-angular';
|
import { IonicPageModule } from 'ionic-angular';
|
||||||
import { BlockDetailPage } from './block-detail';
|
import { BlockDetailPage } from './block-detail';
|
||||||
|
import { TransactionsComponent } from '../../components/transactions/transactions';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
BlockDetailPage
|
BlockDetailPage,
|
||||||
|
TransactionsComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
IonicPageModule.forChild(BlockDetailPage)
|
IonicPageModule.forChild(BlockDetailPage)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user