Skip to content

Instantly share code, notes, and snippets.

import { Injectable } from '@angular/core';
import { Http, Headers, Response } from "@angular/http";
import { Observable } from "rxjs";
import Web3 from 'web3'; /** I think this is equivalent
to the require function. I'm also doing 'web3/lib because that is where the web3.js file is*/
let web3:Web3 = new Web3();
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} /** set the provider you want from Web3.providers */