我正在使用ng2-file-upload,文件可以正确上传,但我也想显示以前上传的文件,我已经调用了一个 API 并将所有以前上传的文件存储在组件中的一个数组中,但是如何显示它HTML 页面。
<div class="container">
<div class="row">
<div class="col-md-3">
<h3>Select files</h3>
Multiple
<input type="file" ng2FileSelect [uploader]="uploader" multiple /><br/>
<table class="table">
<thead>
<tr>
<th width="50%">Name</th>
<th>Size</th>
<th>Progress</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of uploader.queue">
<td><strong>{{ item?.file?.name }}</strong></td>
<td *ngIf="uploader.isHTML5" nowrap>{{ item?.file?.size/1024/1024 | number:'.2' }} MB</td>
<td *ngIf="uploader.isHTML5">
<div class="progress" style="margin-bottom: 0;">
<div class="progress-bar" role="progressbar" [ngStyle]="{ 'width': item.progress + '%' }"></div>
</div>
</td>
</tr>
</tbody>
</table>
<div>
<button type="button" class="btn btn-success btn-s"
(click)="uploader.uploadAll()" [disabled]="!uploader.getNotUploadedItems().length">
<span class="glyphicon glyphicon-upload"></span> Upload all
</button>
<button type="button" class="btn btn-warning btn-s"
(click)="uploader.cancelAll()" [disabled]="!uploader.isUploading">
<span class="glyphicon glyphicon-ban-circle"></span> Cancel all
</button>
<button type="button" class="btn btn-danger btn-s"
(click)="uploader.clearQueue()" [disabled]="!uploader.queue.length">
<span class="glyphicon glyphicon-trash"></span> Remove all
</button>
</div>
</div>
</div>
</div>
我已经在“队列”数组中获取了上传的文件,我如何在此处显示
uploadfiles() {
this.common.getData(url).subscribe(
data => {
this.queue.push({
name: file.Name,
id: file.Id,
size: file.Size
})}