Skip to content

Commit

Permalink
feat: inputEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Sep 5, 2016
1 parent e502075 commit 538eab6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ng2-uploader",
"description": "Angular2 File Uploader",
"version": "1.0.0",
"version": "1.0.1",
"license": "MIT",
"main": "ng2-uploader.ts",
"author": "Jan Kuri <[email protected]>",
Expand All @@ -12,7 +12,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/jkuri/ng2-uploader.git"
"url": "https://github.com/jkuri/ng2-uploader.git"
},
"keywords": [
"ng2",
Expand Down
7 changes: 7 additions & 0 deletions src/directives/ng-file-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {Ng2Uploader} from '../services/ng2-uploader';
})
export class NgFileDropDirective {
@Input() options: any;
@Input() events: EventEmitter<any>;
@Output() onUpload: EventEmitter<any> = new EventEmitter();
@Output() onPreviewData: EventEmitter<any> = new EventEmitter();

Expand All @@ -36,6 +37,12 @@ export class NgFileDropDirective {
this.onPreviewData.emit(data);
});

this.events.subscribe((data: string) => {
if (data === 'startUpload') {
this.uploader.uploadFilesInQueue();
}
});

this.initEvents();
}

Expand Down
7 changes: 7 additions & 0 deletions src/directives/ng-file-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Ng2Uploader } from '../services/ng2-uploader';
})
export class NgFileSelectDirective {
@Input() options: any;
@Input() events: EventEmitter<any>;
@Output() onUpload: EventEmitter<any> = new EventEmitter();
@Output() onPreviewData: EventEmitter<any> = new EventEmitter();

Expand All @@ -35,6 +36,12 @@ export class NgFileSelectDirective {
this.uploader._previewEmitter.subscribe((data: any) => {
this.onPreviewData.emit(data);
});

this.events.subscribe((data: string) => {
if (data === 'startUpload') {
this.uploader.uploadFilesInQueue();
}
});
}

filterFilesByExtension(): void {
Expand Down

0 comments on commit 538eab6

Please sign in to comment.