Cannot find module ‘rxjs/symbol/observable’ on ng serve

npm install rxjs@6 rxjs-compat@6 –save

This solves the all angular 6 problems regarding Rxjs…

Advertisements

AngularJs Download file

Java script :

===========

$scope.downloadImage=function(fileName){
$http({
url: ‘http://localhost:6061/file/download/:fileName’,
method: “GET”,
params: {
fileName: fileName
},
responseType: ‘arraybuffer’
}).success(function(data){
console.log(data);
var url = URL.createObjectURL(new Blob([data]));
var a = document.createElement(‘a’);
a.href = url;
a.download = fileName;
a.target = ‘_blank’;
a.click();
})
}

java:

====

@RequestMapping(value = “/download/{fileName}”, method = RequestMethod.GET)
public void downloadImage(@RequestParam String fileName, HttpServletResponse response) {
UploadFile file=fileUploadRepo.getByFileName(fileName);
try {
response.setContentType(file.getFileContentType());

response.setHeader(“Content-Disposition”, “attachment; filename=” + file.getFileName());

response.setContentLength(file.getData().length);

response.getOutputStream().write(file.getData());

response.getOutputStream().flush();

response.getOutputStream().close();

} catch (Exception e) {
System.out.println(“Error occur during download attachment file : ” + fileName);
System.out.println(“Error : ” + e);
}
}