title: Handling the response from Angular 5 Http call
body: <pre><code>getItems() {
      this.fetchItemsService.fetchItems(this.url, this.searchTex).subscribe((res) =&gt; {
          this.repos = res['items'];
      })
  }
  </code></pre>
  
  <p>Above code is working fine but initially I tried as follow</p>
  
  <pre><code>getItems() {
      this.fetchItemsService.fetchItems(this.url, this.searchText).subscribe((res) =&gt; {
         this.items= res.items;
     })
  }
  </code></pre>
  
  <p>This is throwing an error <strong>Items</strong> is not defined on <strong>res</strong> </p>
  
  <blockquote>
    <p><strong>res</strong> is an object</p>
  </blockquote>
  
  <p>Why is it like that?</p>