title: Pushing objects into Object Array - Typescript
body: <p>Having trouble with some code here. Building an application but stumbling over how to work with array objects. I provided the code above NgInit{}. And provided the TS error I am getting in Xcode. </p>
  
  <h1>Full component</h1>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { Ticker } from '../TickerType'; 
  import { ConversionService } from '../Conversion.service';
  import {Observable} from 'rxjs/Rx';
  import {resultsType} from './resultsTypeInterface';
  @Component({
    selector: 'app-contents',
    templateUrl: './contents.component.html',
    styleUrls: ['./contents.component.scss']
  })
  export class ContentsComponent implements OnInit{
  
  //Will hold the data from the JSON file
  
  
    // Variables for front end
   cryptoSelected : boolean = false;
   regSelected : boolean = false;
   step2AOptions : any[] = [
        {name: "make a selection..."},
        {name: "Bitcoin"},
        {name: "DASH"},
        {name: "Etherium"}  
      ]; // step2AOptions
   step2BOptions : any[] = [
        {name: "make a selection..."},
        {name: "CAD"},
        {name: "USD"} 
      ]; // step2BOptions
   step2Selection: string;
   holdings: number = 10;
  
  coins: any[] = ["BTC_ETH", "BTC_DASH"];
  ticker: Ticker[];
  coinResults: resultsType[] =[]; 
  currencyExchange:any[] = [];   
  
    constructor( private conversionService: ConversionService ) { 
  
    }
  </code></pre>
  
  <h1>Error</h1>
  
  <pre><code>Argument of type '{ name: string; amount: any; }[]' is not assignable to parameter of type 'resultsType'.
    Property 'name' is missing in type '{ name: string; amount: any; }[]'.
  </code></pre>
  
  <p>This is happening in the code below. What I am trying to do is push this objects into an Object Array so I can access properties of like. </p>
  
  <pre><code>console.log(coinsResults[0].name);
  </code></pre>
  
  <h1>Code</h1>
  
  <pre><code>ngOnInit(){
    this.conversionService.getFullTicker().subscribe((res) =&gt; {this.ticker = res;
  
    for(var j = 0; j&lt;= this.coins.length-1; j++)
    {
      var currencyName: string = this.coins[j];
      if(this.ticker[currencyName])
      {
        var temp = [{name: currencyName, amount: this.ticker[currencyName].last} ]
        this.coinResults.push(temp)
      }
    }//end the for loop
    }); //end the subscribe function                                                       
   this.conversionService.getFullCurrencyExchange().subscribe( (res) =&gt; {this.currencyExchange = res["rates"]
    });
    console.log(this.coinResults);
  }// End OnInit
  </code></pre>