Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bug): ng-upload filelist binding #3617

Closed
dylanvdmerwe opened this issue Jun 20, 2019 · 2 comments
Closed

(bug): ng-upload filelist binding #3617

dylanvdmerwe opened this issue Jun 20, 2019 · 2 comments
Assignees

Comments

@dylanvdmerwe
Copy link

Reproduction link

https://angular-y1cpfq.stackblitz.io

Steps to reproduce

Setup an nz-upload component.
Binding it to a fileList as per the docs.
Once the page has loaded, perhaps there are some files that need to be displayed that are loaded asynchronously.
Add these images into the fileList by pushing or recreating the

What is expected?

A picture-card nz-upload component should display images that have been added into the fileList.

What is actually happening?

Binding issue. Items added manually into fileList do not appear on the images for the component.

Environment Info
ng-zorro-antd 7.5.1
Browser Chrome 75
@cipchk
Copy link
Member

cipchk commented Jun 20, 2019

According to Angular documentation,developers should not use push or splice to change the data passed to nzFileList

  ngOnInit() {
    setTimeout(() => {
      console.log("adding new image");
      this.fileList = this.fileList.concat(
        {
          uid: -2,
          name: 'xxx.png',
          status: 'done',
          url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
        }
      )
    }, 4000);
  }

@dylanvdmerwe
Copy link
Author

Yes I can confirm the binding does work when using concat. Thank you for the information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants