Skip to content

AndrewJBateman/angular-app-crypto

Repository files navigation

⚡ Angular App Crypto

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • Angular httpClient used to get API data
  • Data displayed using one-way data-binding and an *ngFor loop
  • Separate data.service.ts file used to get API price data. This data is subscribed to in app.component.ts

📷 Screenshots

Example screenshot.

📶 Technologies

💾 Setup

  • Install dependencies using npm i.
  • Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

💻 Code Examples

  • data.service.ts using httpClient service with a getPrices() function to get crypto currency details from the API.
@Injectable()
export class DataService {
  result: any;
  currencyCode: string;
  display: string;

  constructor(private http: HttpClient) {}

  // function to get crypto prices in euro from the API - no API key required.
  getPrices() {
    const fsymsList =
      "BTC,XRP,BCH,ETH,ZEC,EOS,XMR,ETC,LTC,DASH,QTUM,NEO,XLM,TRX,ADA,BTS,USDT,XUC,PAX,IOT";
    return this.http
      .get(
        "https://min-api.cryptocompare.com/data/pricemulti?fsyms=" +
          fsymsList +
          "&tsyms=EUR"
      )
      .pipe(map((result) => (this.result = result)));
  }
}

🆒 Features

  • Angular httpClient used to get data from an external API.
  • Angular currency pipe & rxjs map operator used to extract currency data and display it to the correct format.
  • Dependencies updated with 0 dependency vulnerabilities.

📋 Status & To-Do List

  • Status: Working
  • To-Do: Nothing

👏 Inspiration

📁 License

  • This project is licensed under the terms of the MIT license.

✉️ Contact