title: how to display http error message angular 6
body: <p>I am using the below methods to send data. I want to display an error response on my component. How can I console log error message in my component?</p>
  
  <p><strong>component.ts</strong></p>
  
  <pre><code>signup(){ 
      return this.loginservice.signupUser(this.model).subscribe(data =&gt; {
          console.log(data.error);
      });
  }
  </code></pre>
  
  <p><strong>service ts</strong></p>
  
  <pre><code>signupUser(signupuserModel: any = {}):Observable&lt;any&gt;{
      return this.http.post(`${this.signuouserurl}`,signupuserModel)
  }
  </code></pre>
  
  <p><strong>error message</strong>
  <a href="https://i.stack.imgur.com/w40TK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w40TK.png" alt="enter image description here"></a></p>