We are displaying the details of the user in an HTML page and apart from other details it contains a link item in it, which retrieves the image stored as BLOB of the user from the database. Our angular Service is written, Click on the link item opens (which is actually the filename of that image in the database) up a browser window displaying the Image. Both storing and retrieving the image works fine Now our requirement is to just load on first load of HTML page the Image as a preview.
Angular service is like
getDownloadDoc: function(empId) {
return $http.get(contextPath1 + "/PdfServletDoc?documentID=" + empId + "", {
responseType: 'arraybuffer'
}).then(function(response) {
var data = response.data;
var file = new Blob([data], {
type: 'image/jpeg'
});
var fileURL = URL.createObjectURL(file);
window.open(fileURL);
return response;
});
},
I am new to AngularJs, if could only get the resources or documentations to look for this. That will be helpful