2017-04-20 68 views
0

当我上传一张图片时,效果非常好! 但每两一旦$文件为空就发送之前...

<button ngf-select="upload($file)" 
     ngf-pattern="'image/*'" 
     ngf-accept="'image/*'" 
     multiple 
     class="btn btn-success"> 
    Add</button> 

JS:

$scope.upload = function (file) { 
    console.log(file) 
    Upload.upload({ 
    data: {resource: file}, 
    url: 'http://localhost:3000/api/v1/resource/parking/' + $scope.parking._id, 
    headers: {'Authorization': 'Bearer' + $auth.getToken()} 
    }).then(function (response) { 
    getParking(); 
    $scope.messagesConfigurationGalerie = { 
     success: Array.isArray(response.data) ? response.data : [response.data] 
    }; 
    }) 
    .catch(function (response) { 
     $scope.messagesConfigurationGalerie = { 
     error: Array.isArray(response.data) ? response.data : [response.data] 
     }; 
    }); 
}; 

的执行console.log(文件)是空每隔两 泰

回答

0

如果我重新加载每个上传之间的页面,它的作品...