title: Angular 4: How to read content of text file with HTTPClient
body: <p>I have a .txt file in my Angular 4 project directory and I want to read its content. How to do it ? Below is the code which I employed. </p>
  
  <p>The file is in 'files' folder which is inside the 'app' folder. 
  The component where i have HTTPClient code is in 'httpclient' folder which is inside 'app' folder. </p>
  
  <p>Meaning 'files' folder and 'httpclient' folder are children. </p>
  
  <p>The code is shown below. It not working as i m getting 404 error - 'GET <a href="http://localhost:4200/files/1.txt" rel="noreferrer">http://localhost:4200/files/1.txt</a> 404 (Not Found)'</p>
  
  <pre><code>this.http.get('/files/1.txt').subscribe(data =&gt; {
          console.log(data);
      },
          (err: HttpErrorResponse) =&gt; {
              if (err.error instanceof Error) {
                  // A client-side or network error occurred. Handle it accordingly.
                  console.log('An error occurred:', err.error.message);
              } else {
                  // The backend returned an unsuccessful response code.
                  // The response body may contain clues as to what went wrong,
                  console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
              }
          }
      );
  </code></pre>