insight-previous-tcr
Version:
A blockchain explorer for Bitcore
52 lines (48 loc) • 1.53 kB
text/typescript
import { Component, Injectable, ViewChild } from "@angular/core";
import { Events, IonicPage, Nav, NavParams } from "ionic-angular";
import { LatestBlocksComponent } from "../../components/latest-blocks/latest-blocks";
import { ApiProvider, ChainNetwork } from "../../providers/api/api";
import { CurrencyProvider } from "../../providers/currency/currency";
import { PriceProvider } from "../../providers/price/price";
export class HomePage {
public latestBlocks: LatestBlocksComponent;
public chain: string;
private chainNetwork: ChainNetwork;
public network: string;
constructor(
public nav: Nav,
public navParams: NavParams,
private apiProvider: ApiProvider,
private priceProvider: PriceProvider,
public events: Events,
public currencyProvider: CurrencyProvider
) {
const chain: string =
navParams.get('chain') || this.apiProvider.getConfig().chain;
const network: string =
navParams.get('network') || this.apiProvider.getConfig().network;
this.chainNetwork = {
chain,
network
};
this.apiProvider.changeNetwork(this.chainNetwork);
this.currencyProvider.setCurrency(this.chainNetwork);
this.priceProvider.setCurrency();
}
public openPage(page: string): void {
this.nav.push(page, {
chain: this.chain,
network: this.network
});
}
}