title: How to take a collection of data from a c# api and turn it into a array in angular
body: <p>I have a working .Net Core api. I am trying to use a http get request in angular to get a collection of data, and am trying to find out how to turn that collection into an array in angular.</p>
  
  <p>I've tried setting the value to an array that accepts any and I cant seem to find any answers for this out there.</p>
  
  <pre><code>export class GamesComponent implements OnInit {
    games;
  
    constructor(public gamesService: GamesService) { 
  
    }
  
    ngOnInit(){
      console.log(this.gamesService.getGames());
      var arr: any[]
      arr = this.gamesService.getGames();
      this.games = arr;
    }
  
  }
  
  
  export class GamesService {
    constructor(public http: HttpClient) {
  
     }
  
     getGames(){
      const headers = new HttpHeaders().set('Content-Type', 'application/json; charset=utf-8');
      var games = this.http.get(`https://LOCALHOST/api/games`, {headers:headers}).toPromise();
      return games;
     }
  }
  </code></pre>
  
  <p>I am expecting the result from my get request to go into an array in my component that I can use.<code>enter code here</code></p>