After retrieving my file URL from the backend API, I am trying to enable downloading when the user clicks a button.
Currently, the download function works smoothly for Excel files (`.xlsx`), but for text (`.txt`) files or images (`.jpeg`, `.png`), it only opens the file in a new tab instead of triggering the download prompt.
$scope.download = function(row) {
var url = row.entity.downloadUrl; // This is the correct path on the server
window.open(url, "_blank"); // The issue lies here
};
How can this functionality be achieved in AngularJS?
Here is the request: