Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 从angular js下载图像_Angularjs_Web - Fatal编程技术网

Angularjs 从angular js下载图像

Angularjs 从angular js下载图像,angularjs,web,Angularjs,Web,我从MongoDB得到图像。现在我想通过代码将图像下载到我的系统中 从这段代码中,我得到了以下对象: $scope.clickEvent=函数(x){ Bt我下载的东西是: 尝试将内容类型标题和响应类型添加到“blob” $http({ method: 'GET', url: $API_URL + path, headers: { 'Content-Type': 'image/jpg', //content type set to image

我从MongoDB得到图像。现在我想通过代码将图像下载到我的系统中

从这段代码中,我得到了以下对象: $scope.clickEvent=函数(x){

Bt我下载的东西是:

尝试将
内容类型
标题和
响应类型
添加到“blob”

$http({
      method: 'GET',
      url: $API_URL + path,
      headers: {
        'Content-Type': 'image/jpg', //content type set to image
        'Authorization': $localStorage.currentUser.token
      },
      responseType: 'blob' 
    })

我知道答案了,谢谢。
$http({
      method: 'GET',
      url: $API_URL + path,
      headers: {
        'Content-Type': 'image/jpg', //content type set to image
        'Authorization': $localStorage.currentUser.token
      },
      responseType: 'blob' 
    })