title: Angular's new http client error Cannot read property 'data' of undefined
body: <p>I am learning how to use angular's new http client module. I get the error Cannot read property 'data' of undefined when I try to consume the rest api.
  Here's my app.html,</p>
  
  
  
  <pre><code>&lt;div style="text-align:center"&gt;
    &lt;h1&gt;
      Welcome to {{title}}!
    &lt;/h1&gt;
    &lt;button (click)="getPosts()"&gt;Get Posts&lt;/button&gt;
    &lt;div *ngFor="let result of results.data"&gt;
  
        {{ result | json }}
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's my app.component.ts</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import {HttpClient} from '@angular/common/http';
  
  interface ItemsResponse {
    data: any[];
  }
  
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  
  export class AppComponent implements OnInit {
    results: any;
    // Inject HttpClient into your component or service.
    constructor(private http: HttpClient) {}
    title = 'School2College';
  
    ngOnInit(): void {
    }
    getPosts() {
      this.http.get&lt;ItemsResponse&gt;('https://reqres.in/api/users?page=3').subscribe(res =&gt;
        this.results = res);
    }
  }
  </code></pre>
  
  <p>Why do I get the error Cannot read property 'data' of undefined?</p>