0
我想提交一個文件,我輸入了一次,我點擊了系統窗口上的文件上傳確定,但我不知道該怎麼做......這就是我'已經這樣做的遠:導入文件並在彈出窗口關閉時提交AngularJS
<input type="file" id="file-input" style="display:none" />
<button class="btn pull-right" ng-click="submitCashierFile()">Import</button>
JS:
$scope.submitCashierFile = function() {
angular.element('#file-input').trigger('click');
// I should have something like this next i guess?
$scope.cashierfile.upload = Upload.upload({
url: config.baseAddress + 'test/uploadCashierExcel',
data: { file: $scope.cashierfile }
});
$scope.cashierfile.upload.then(function (response) {
$timeout(function() {
$scope.cashierfile.result = response.data;
toastService.success('You have added .xlsx');
});
}, function (response) {
toastService.error(response);
});
};
所以我通過靶向點擊,打開模式選擇文件,對我來說,問題是如何提交上單擊該模式的確定。有什麼建議麼?
如果你用[ng-file-upload](https://github.com/danialfarid/ng-file-upload)沒關係,我會建議去那。它很容易實現你想要使用這個。 – Ashish