I have seen this same question here, however the solution is not working in my case and inputting the code snipped that was used
$('<form action="'+ url +'" method="'+ ('post') +'">'+inputs+'</form>')
.appendTo('body').submit().remove();
returns an error that Reference $ is not defined
I have a download request that looks like this:
controller.js
$http.put('/download' {file:$scope.inputInfo.name.$modelValue+'.csv'}).success(function(data,status,headers){
console.log(status);
console.log(data);
})
app.js
app.put('/download', function(req,res){
console.log(req.body.file)
res.download(__dirname +'/'+ 'req.body.file, function(err){
if(err){console.log(err)}
})
})
My controller.js is returning the raw file output as data and not initiating the download from the page. Is there something I am missing to initiate this file download in angular? Any help would be greatly appreciated.