2.0 KiB
2.0 KiB
Usage
import { FileSelectDirective, FileDropDirective, FileUploader } from 'ng2-file-upload/ng2-file-upload';
Annotations
// class FileSelectDirective
@Directive({ selector: '[ng2FileSelect]' })
// class FileDropDirective
@Directive({ selector: '[ng2FileDrop]' })
FileSelect API
Properties
uploader- (FileUploader) - uploader object. See using in demo
Parameters supported by this object:
url- URL of File Uploader's routeauthToken- auth token that will be applied as 'Authorization' header during file send.disableMultipart- If 'true', disable using a multipart form for file upload and instead stream the file. Some APIs (e.g. Amazon S3) may expect the file to be streamed rather than sent via a form. Defaults to false.itemAlias- item alias (form name redefenition)formatDataFunction- Function to modify the request body. 'DisableMultipart' must be 'true' for this function to be called.formatDataFunctionIsAsync- Informs if the function sent in 'formatDataFunction' is asynchronous. Defaults to false.
FileDrop API
Properties
uploader- (FileUploader) - uploader object. See using in demo
Events
fileOver- it fires during 'over' and 'out' events for Drop Area; returnsboolean:trueif file is over Drop Area,falsein case of out. See using in ts demo and html demoonFileDrop- it fires after a file has been dropped on a Drop Area; you can pass in$eventto get the list of files that were dropped. i.e.(onFileDrop)="dropped($event)"