diff --git a/app/src/components/transactions/transactions.ts b/app/src/components/transactions/transactions.ts
index f2bb011..111310b 100644
--- a/app/src/components/transactions/transactions.ts
+++ b/app/src/components/transactions/transactions.ts
@@ -16,8 +16,8 @@ import { Http } from '@angular/http';
export class TransactionsComponent {
public loading: boolean = true;
- @Input() public blockHash: string;
- @Input() public address: string;
+ @Input() public queryType: string;
+ @Input() public queryValue: string;
public transactions: any = [];
constructor(private navCtrl: NavController, private http: Http) {
@@ -25,21 +25,10 @@ export class TransactionsComponent {
private ngOnInit(): void {
let apiPrefix: string = 'http://localhost:3001/insight-api/';
- let lookupType: string, lookupValue: string;
- if (this.blockHash) {
- lookupType = 'blocks';
- lookupValue = this.blockHash;
- }
- if (this.address) {
- lookupType = 'address';
- lookupValue = this.address;
- }
+ let url: string = apiPrefix + 'txs?' + this.queryType + '=' + this.queryValue;
- console.log('blockHash', this.blockHash);
- console.log('address', this.address);
-
- this.http.get(apiPrefix + 'txs?' + lookupType + '=' + lookupValue).subscribe(
+ this.http.get(url).subscribe(
(data) => {
this.transactions = JSON.parse(data['_body']);
this.loading = false;
diff --git a/app/src/pages/address/address.html b/app/src/pages/address/address.html
index 11ab88f..08555a7 100644
--- a/app/src/pages/address/address.html
+++ b/app/src/pages/address/address.html
@@ -49,5 +49,5 @@
-
Next Block {{ block.height + 1 }}
Loading...
diff --git a/app/src/pages/block-detail/block-detail.module.ts b/app/src/pages/block-detail/block-detail.module.ts index 1a14b2f..8a301c0 100644 --- a/app/src/pages/block-detail/block-detail.module.ts +++ b/app/src/pages/block-detail/block-detail.module.ts @@ -1,15 +1,15 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { BlockDetailPage } from './block-detail'; -import { TransactionsComponent } from '../../components/transactions/transactions'; +import { TransactionsComponentModule } from '../../components/transactions/transactions.module'; @NgModule({ declarations: [ - BlockDetailPage, - TransactionsComponent + BlockDetailPage ], imports: [ - IonicPageModule.forChild(BlockDetailPage) + IonicPageModule.forChild(BlockDetailPage), + TransactionsComponentModule ], exports: [ BlockDetailPage