title: Angular: prevent auto recompile when there is a change in assets folder
body: <p>I'm trying to download a file generated from spring boot in the assets of the angular project. When I call the spring API from angular services, angular CLI recompiles the project after the creation of the file in assets angular folder, and then it reloads the page before getting the response from spring boot API.</p>
  
  <p>I tried to call the spring boot API from angular in many ways: </p>
  
  <ul>
      <li>calling the api in the ngOnInit() of my component</li>
      <li>calling the api in the constructor of my component</li>
      <li>calling the api in a separate function</li>
      <li>using async await in the download function</li>
  </ul>
  
  <p>I don't know ho to proceed</p>
  
  <p><b>spring boot</b></p>
  
  <pre><code> @GetMapping(path = "/downloads/{fileId}", produces = "application/json")
      @ResponseBody
      public ResponseEntity&lt;String&gt; download(@PathVariable String fileId){
          Gson gson = createGson();
  
          List&lt;com.bioimis.blp.entity.File&gt; fileById;
  
          try {
              fileById = fileRepository.findFileById(fileId);
  
          } catch (Exception e) {
              logger.error(e.getMessage());
              return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
          }
  
          if (fileById.isEmpty()) {
              logger.error(fileId + " not found");
              return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
          }
  
          if(fileById.get(0).getDeletionDate() != null) {
  
              List&lt;String&gt; phrases = new ArrayList&lt;&gt;();
  
              try {
                  phrases = translationRepository.getAllTranslationsByFileId(fileById.get(0).getId());
              } catch (Exception e) {
                  logger.error(e.getMessage());
                  return ResponseEntity.status(HttpStatus.OK).body(null);
              }
  
              String file = "";
  
              for (int i = 0; i &lt; phrases.size(); i++) {
                  file = file.concat(phrases.get(i));
              }
              file = file.concat("\0");
  
              /*Suppongo che prima dell'estensione gli ultimi 5 caratteri del file sono in formato 'languageCode_countryCode'*/
              String nameFile = fileById.get(0).getPath().split("/")[fileById.get(0).getPath().split("/").length - 1];
  
              Language language;
              try {
                  language = languageRepository.findLanguageById(fileById.get(0).getLanguageId()).get(0);
              } catch (Exception e) {
                  logger.error(e.getMessage());
                  return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
              }
  
              int i = StringUtils.lastIndexOf(nameFile, '.');
              String ext = StringUtils.substringAfter(nameFile, ".");
  
              nameFile = nameFile.substring(0, i - 5) + language.getLanguageCode() + "_" + language.getCountryCode() + "." + ext;
  
              Path path = Paths.get(pathDownload + "/" + nameFile);
  
              try {
  -----------------------------------------------------------------------------
                  Files.write(path, file.getBytes());
  ------------&gt;after this instruction, angular reloads the page&lt;---------------
  -----------------------------------------------------------------------------
              } catch (IOException e) {
                  logger.error(e.getMessage());
                  return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null);
              }
  
              return ResponseEntity.status(HttpStatus.OK).body(gson.toJson(path.toString()));
          }
  
          return ResponseEntity.status(HttpStatus.OK).body(null);
      }
  </code></pre>
  
  <p><b>Angular Component</b></p>
  
  <pre><code> downloadFile(fileId: string) {
      let link: string;
  
      this.http.downloadFile(fileId).subscribe(
        data =&gt; {
          link = data;
        }
      );
  
      console.log(link);
      return link;
    }
  </code></pre>
  
  <p><b>Angular Service</b> </p>
  
  <pre><code>downloadFile(fileId: string) {
      const myheader = new HttpHeaders().set('Authorization', this.token);
      return this.http.get&lt;string&gt;(this.url.concat('files/downloads/' + fileId), { headers: myheader });
    }
  </code></pre>
  
  <p>I just expect to get the response from spring boot api without reloading the angular component.</p>
  
  <p>(In postman it works as it has to be)</p>