0
사용자가 파일을 업로드 할 때 업로드 버튼을 숨기고 새로운 편집 버튼을 표시하려고합니다. 각도 파일 업로드 및 MD 데이터 테이블 라이브러리를 사용하고 있습니다. 클릭 한 행을 저장하기 위해 테스트 함수를 사용하고 파일을 업로드 한 후 json 안에 업로드 된 값을 변경합니다. 그것은 user_doc의 JSON 객체의 값을 true로 변경하지만이 컨트롤러에서 내 HTMLjson 데이터가 변경된 경우 트리거 표시
<md-table-container>
<table md-table multiple ng-model="selected">
<thead md-head md-order="query.order">
<tr md-row>
<th md-column><span class="settings-header">Tipo de documento</span></th>
<th md-column><span class="settings-header actions">Acciones</span></th>
</tr>
</thead>
<tbody md-body>
<tr md-row md-select-id="id" md-auto-select ng-repeat="row in options">
<td md-cell>{{row.name}}</td>
<td md-cell class="buttons-cell" ng-show="!uploaded">
<div ng-if="uploader">
<label for="key" class="md-button profile-upload" ng-click="test(row)" ng-if="!uploaded"><i class="material-icons">file_upload</i></label>
<!-- <label for="key" class="md-button profile-upload" ng-click="test(row)" ng-if="uploaded"><i class="material-icons">PERP</i></label> -->
<input class="ng-hide" id="key" type="file" nv-file-select uploader="uploader" ng-if="!uploaded">
</div>
</td>
</tr>
</tbody>
</table>
발췌문에서 싹둑 인 HTML
의 버튼을 숨길 나던
$scope.uploader = new FileUploader();
let row_selection;
$scope.test = function(row,fileItem){
console.log(row.id);
row_selection = row;
}
$scope.uploader.onAfterAddingFile = function(fileItem) {
if(fileItem.file.type === 'image/png' || fileItem.file.type === 'image/jpeg'){
row_selection.uploaded = true;
}else{
showAlert();
}
}
$scope.user_doc = {
documents: {
options: [
{"id":"01","name":"INE","uploaded":false},
{"id":"02","name":"Comprobante de domicilio","uploaded":false},
{"id":"03","name":"CURP","uploaded":false}
]
}
};
$scope.options = $scope.user_doc.documents.options;