0
ファイルオブジェクトをイメージオブジェクトに変換することはできますか?
私は(イメージです)ファイルから幅と高さを必要とするが、ここに私のコードです:AngularJS - ファイルオブジェクトをイメージオブジェクトに変換する
ビュー:
<button id="image_file" class="md-button md-raised md-primary"
type="file" ngf-select="uploadFile($file)">
SELECT FILE
</button>
<md-input-container>
<div class="raised">
<input id="image_file_name" type="text" ng-model="vm.file.name"></input>
</div>
</md-input-container>
コントローラ:
app.controller('imageController', function($scope, fileService) {
$scope.vm = {};
$('.intro').show(1000);
$scope.uploadFile = function(file) {
$scope.vm.file = "";
$scope.vm.file = file; //<---- for example here, how it should be done?
fileService.uploadFile($scope);
}
サービス:
angular.module('app')
.service('fileService', function ($http, validationService) {
this.uploadFile = function ($scope){
if (validationService.isFileValidate($scope)) {
$scope.vm.acceptableFormat = true;
} else {
$scope.vm.acceptableFormat = false;
}
};
});
ファイルはどのように選択されていますか?私は ''はどこですか? – Searching
@ view 'コード'の上部にあるボタンを検索していますが、ここでng-file-uploadを使用しています – dante
まだ動作していませんか? – Searching