Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ng-repeat="file in filelist" does not work properly #2546

Closed
@catphive

Description

FileList is one of the many array-like objects that the DOM defines. Iteration over them with ng-repeat="file in filelist" does not seem to work quite right. For example:

<li ng-repeat="file in filelist">{{file.name}}</li>

will on chrome produce an extra empty LI at the end.

I'm not sure about the iteration process that angular uses, but generally for array-like objects that the dom provides you either want to convert first to an array, or only iterate using simple indexing and length.

https://developer.mozilla.org/en-US/docs/DOM/FileList
http://dev.w3.org/2006/webapi/FileAPI/#dfn-filelist

Note that you get a FileList as the files attribute on input elements with type="file" attribute.

<input type="file" id="my-file-input"></input>

document.getElementById('my-file-input').files

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions