我正在尝试上传默认加载时间img标签的图片,我不知道为什么加载,我没有放置任何img标签 这是我的HTML代码
<div class="col-sm-3">
<input type="file" ng-click="clear()"
onchange="angular.element(this).scope().upload(event)" accept="image/png, image/jpeg,image/jpg" style="display: block;" />
</div>
<div class="col-sm-3">
<button class="btn btn-primary btn-md" ng-click="click()">Upload</button>
</div>
上传图片后,结果将如下所示
<div class="col-sm-3">
<input type="file" ng-click="clear()"
onchange="angular.element(this).scope().upload(event)" accept="image/png, image/jpeg,image/jpg" style="display: block;" />
<img src = "base64 Image DATA " >
</div>
<div class="col-sm-3">
<button class="btn btn-primary btn-md" ng-click="click()">Upload</button>
</div>
JS
$scope.setImage = function (image) {
$scope.display = $scope.images[image];
}
$scope.upload = function (obj) {
var elem = obj.target || obj.srcElement;
$scope.file = elem.files[0];
var reader = new FileReader();
$scope.fileName = $scope.file.name;
reader.onload = function (e) {
$scope.display = e.target.result;
$scope.$apply();
}
reader.readAsDataURL($scope.file);
}
$scope.afterClick = false;
$scope.loadingImages = true;
$scope.errors = true;
$scope.click = function() {
$scope.loadingImages = false;
Upload.upload(
{
method : 'POST',
url : 'http://localhost:8080/image/getDeepLearningPredections',
file : $scope.file,
data : {
fileName : $scope.fileName,
}
}).then(function(response) {
}
```
In the Above added JS code
Please let me know what is the problem