Angular2 component with Drag and Drop support for files
npm install angular2-rc1-file-dropAngular2 component with Drag and Drop support for files
``bash`
npm install angular2-file-drop
`ts
import { Component, Output } from '@angular/core';
import { FileDropDirective } from 'angular2-file-drop';
@Component({
selector: 'upload',
template:
,
directives: [ FileDropDirective ]
})
export class PartiesUpload {
public fileIsOver: boolean = false;
@Output() public options = {
readAs; 'ArrayBuffer'
}; private file: File;
public fileOver(fileIsOver: boolean): void {
this.fileIsOver = fileIsOver;
}
public onFileDrop(file: File): void {
console.log('Got file!');
}
}
`Options
- readAs? :
DataURL, ArrayBuffer, BinaryString or Text`