1

Here is the API link https://min-api.cryptocompare.com/data/all/coinlist

I want to get currency Name and Symbol, how do i refer in ionic angular ...

here is my code in ionic coin.ts file

    import { Component } from '@angular/core';
    import { IonicPage, NavController, NavParams } from 'ionic-angular';

    import { Http } from '@angular/http';
    import 'rxjs/add/operator/map';

    @IonicPage()
    @Component({
      selector: 'page-convert',
      templateUrl: 'convert.html',
    })
    export class ConvertPage {

        public coins: any;

      constructor(public navCtrl: NavController, public http: Http) {

        this.http.get('https://min-api.cryptocompare.com/data/all/coinlist').map(res => res.json()).subscribe(data => {
            this.coins = data.Data;
        });
      }

    objectKeys(obj) {
    return Object.keys(obj);
    }

    }

here is the code from coin.html

    <select>
    <option *ngFor="let coin of objectKeys(coins)" value="0">{{coins[coin].Name}} (BTC)</option>
    </select>

now i am getting this error ERROR TypeError: Cannot convert undefined or null to object

Ace Spades
  • 11
  • 5

0 Answers0