diff --git a/app/src/components/denomination/denomination.html b/app/src/components/denomination/denomination.html index ab0aefb..95b29fa 100644 --- a/app/src/components/denomination/denomination.html +++ b/app/src/components/denomination/denomination.html @@ -4,9 +4,9 @@ - - + + diff --git a/app/src/components/denomination/denomination.ts b/app/src/components/denomination/denomination.ts index e683b1c..3d2de77 100644 --- a/app/src/components/denomination/denomination.ts +++ b/app/src/components/denomination/denomination.ts @@ -10,7 +10,6 @@ export class DenominationComponent { public text: string; public switcherOn: boolean; - public currencies: any = []; public units: any = []; constructor( @@ -19,18 +18,6 @@ export class DenominationComponent { ) { this.text = 'Hello World'; this.switcherOn = true; - this.currencies = [ - { - name: 'Bitcoin', - ticker: 'BTC', - url: 'https://insight.bitpay.com' - }, - { - name: 'Bitcoin Cash', - ticker: 'BCH', - url: 'https://bch-insight.bitpay.com' - } - ]; this.units = [ 'USD', @@ -44,11 +31,9 @@ export class DenominationComponent { this.viewCtrl.dismiss(); } - public changeCurrency(currency: any): void { - console.log('selected currency is', currency.name, currency.ticker); + public changeExplorer(explorer: any): void { this.close(); - let theUrl: string = currency.url; - console.log('theUrl is', theUrl); + let theUrl: string = explorer.url; window.location.href = theUrl; } } diff --git a/app/src/providers/currency/currency.ts b/app/src/providers/currency/currency.ts index 19062a2..b1624e8 100644 --- a/app/src/providers/currency/currency.ts +++ b/app/src/providers/currency/currency.ts @@ -18,10 +18,22 @@ export class CurrencyProvider { private bitstamp: number; private kraken: number; private loading: boolean; + private explorers: any = []; constructor(public http: Http, private api: ApiProvider) { this.defaultCurrency = 'BCH'; this.currencySymbol = this.defaultCurrency; + + this.http.get(this.api.apiPrefix + 'explorers').subscribe( + (data) => { + this.explorers = JSON.parse(data['_body']); + this.loading = false; + }, + (err) => { + console.log('err is', err); + this.loading = false; + } + ); } public roundFloat(aFloat: number, decimalPlaces: number): number {