title: Getting Syntax error in Response data in angular4 while trying to download an excel file
body: <p>I'd like to download an excel file by clicking a button in my angular Page.
  When a user clicks the <code>button</code>, the click event triggers a service-method call:</p>
  
  <pre><code>downloadExcel(){
      this.componentService.getExel().subscribe(
          data =&gt; {
            console.log("To Download:", data);      // this part is not executed, throwing Syntax Error* shown below
            //Here, function called to download excel-file with data
          }
     );
  }
  </code></pre>
  
  <p>The Service:</p>
  
  <pre><code>getExel(){
      let url = 'http://url/endpoint/';
      return this.httpClient.get(url);
  }
  </code></pre>
  
  <p>**Syntax Error:</p>
  
  <blockquote>
    <p>error: SyntaxError: Unexpected token P in JSON at poisition 0 at
    JSON.parse</p>
  </blockquote>
  
  <p>In Django REST Framework Side:</p>
  
  <pre><code>class GetExcel(APIView):
      def get(self, request, format=None):
         with open('path/to/excel/file', 'rb') as tempfile:
             tempdata = tempfile()
             ResponseData = HttpResponse(tempdata, content_type='application/vnd...')
             ResponseData['Conetent-Disposition']="attachment; filename=%s" %Filename
         return ResponseData
  </code></pre>
  
  <p>So, I couldn't figure out where I made the mistake. And Please tell how to fix it.</p>