ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
43 lines (40 loc) • 1.13 kB
text/typescript
// tslint:disable
import { Component } from '@angular/core';
import { UploadFile } from './../../components/upload/interface';
export class NzDemoUploadFilterComponent {
fileList = [{
uid: -1,
name: 'xxx.png',
status: 'done',
url: 'http://www.baidu.com/xxx.png',
}];
handleChange(info): void {
const fileList = info.fileList;
// 2. read from response and show file link
if (info.file.response) {
info.file.url = info.file.response.url;
}
// 3. filter successfully uploaded files according to response from server
this.fileList = fileList.filter(item => {
if (item.response) {
return item.response.status === 'success';
}
return true;
});
}
}