title: Angular 7: Send response message from service
body: <p>I make request from service file in my Angular project:</p>
  
  <pre><code>signIn(username: string, password: string): Observable&lt;any&gt; {
  
      const formData = ...
          this.http.post(`${this.uri}`, formData, httpOptions)
            .subscribe(res =&gt; console.log(        
                if (statusCode === '0') {
                  this.message = 'test';
  
                } else {
                  this.message2 = 'test2';
                }
              })));
          return;
        }
  </code></pre>
  
  <p>This function works very well. But I cannot shot my <code>message</code> in my HTML. When I type {{message}} in HTML, its undefined. 
  I declared <code>message: String;</code> but its not work.
  I guess services are private and this problem is so.</p>
  
  <p>How can I show my response in HTML? What is the best way?</p>
  
  <p>UPDATED: This is my component:</p>
  
  <pre><code>message: String;
  
  signIn(username, password): Observable&lt;any&gt; {
  
      this.cookieService.deleteAll();
  
      this.ls.signIn(username, password).subscribe(res =&gt;
        xml2js.parseString(res, function (err, result) {
          const statusCode = ...
          console.log(statusCode); // it getting statusCode
          if (statusCode === '0') {
            this.message = 'test'; //Potentially invalid reference access to a class field via 'this.' of a nested function
          } else {
  
          }
        }));
        return;
    }
  </code></pre>