How to set reponseType as blob for $ http in AngularJs?

I need to set the response type as "blob" in angular. How to set Type response for $ http in angularjs? Sample code for the responseType set using XMLHttpRequest is given below. I need to replace XMLHttpRequest with $ http.

var oMyForm = new FormData(); oMyForm.append("js", content); var oReq = new XMLHttpRequest({mozSystem: true}); oReq.open("POST", url, true); oReq.responseType = "blob"; oReq.onload = function(xhr) { }; oReq.onerror = function(xhr) { }; oReq.send(oMyForm); 
+5
source share
1 answer

angular provides a configuration object for this, docs

  $http({ url: "http://localhost:8080/example/teste", method: "POST", responseType: "blob" }) 
+13
source

Source: https://habr.com/ru/post/1202332/


All Articles