9.0.0 • Published 5 months ago

ngx-file-drag-drop v9.0.0

Weekly downloads
205
License
MIT
Repository
github
Last release
5 months ago

ngx-file-drag-drop

Check out the Demo

Install

npm i ngx-file-drag-drop

API reference

NgxFileDragDropModule

import { NgxFileDragDropModule } from 'ngx-file-drag-drop';

@NgModule({
  imports: [
    // the module for this lib
    NgxFileDragDropDropModule
  ]
})

NgxFileDragDropComponent

selector: <ngx-file-drag-drop>

implements: ControlValueAccessor to work with angular forms

Additionnal properties

NameDescription
@Input() multiple: booleanAllows multiple file inputs, false by default
@Input() accept: stringAny value the native accept attribute can get. Doesn't validate input.
@Input() disabled: booleanDisable the input.
@Input() emptyPlaceholder : stringPlaceholder for empty input, default Drop file or click to select
@Input() displayFileSize : booleanShow file size in chip rather than in tooltip, default false
@Input() activeBorderColor: stringA css color for when file is dragged into drop area, default purple
@Output() valueChanged:EventEmitter<File[]>Event emitted when input value changes
addFiles():(files: File[] \| FileList \| File) => voidUpdate input
removeFile():(file:File) => voidRemoves the file from the input
clear(): () => voidRemoves all files from the input
files: File[]Getter for form value
isEmpty: booleanWhether the input is empty (no files) or not

BytePipe

Usage:

<span>{{ 104857600 | byteFormat }}</span>

Output: 100 MB

Validators

import { FileValidators } from "ngx-file-drag-drop";
ValidatorDescription
uniqueFileNamesDisallow two files with same file name
fileExtension(ext: string[])Required file extensions
fileType(types: string[] \| RegExp)Required Mime Types
maxFileCount(count: number)Max number of files
maxFileSize(bytes: number)Max bytes allowed per file
maxTotalSize(bytes: number)Max total input size
requiredAt least one file required
9.0.0

5 months ago

8.0.0

9 months ago

7.0.0

1 year ago

6.0.0

2 years ago

5.1.3

2 years ago

5.1.2

3 years ago

5.1.1

3 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.0.4

4 years ago

4.0.2

4 years ago

3.0.1

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago