2017-04-20 74 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

如果我重新加載每個上傳之間的頁面,它的作品...