Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuri committed Oct 9, 2016
2 parents e5010fd + 9b37f45 commit 661cd09
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ npm install ng2-uploader --save
| calculateSpeed | true/false |
| data | { userId: 12, isAdmin: true } |
| customHeaders | { 'custom-header': 'value' } |
| fieldName | 'user[avatar]'
| fieldReset | true/false
| authToken | 012313asdadklj123123 |
| authTokenPrefix | 'Bearer' (default) |

Expand Down
3 changes: 3 additions & 0 deletions src/directives/ng-file-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export class NgFileSelectDirective {
this.onUpload.emit(data);
if (data.done) {
this.files = this.files.filter(f => f.name !== data.originalName);
if (this.uploader.fieldReset) {
this.el.nativeElement.value = '';
}
}
});

Expand Down
2 changes: 2 additions & 0 deletions src/services/ng2-uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export class Ng2Uploader {
authTokenPrefix: string = 'Bearer';
authToken: string = undefined;
fieldName: string = 'file';
fieldReset: boolean = true;
previewUrl: boolean = false;
calculateSpeed: boolean = false;
_queue: any[] = [];
Expand All @@ -99,6 +100,7 @@ export class Ng2Uploader {
this.authTokenPrefix = options.authTokenPrefix != null ? options.authTokenPrefix : this.authTokenPrefix;
this.authToken = options.authToken != null ? options.authToken : this.authToken;
this.fieldName = options.fieldName != null ? options.fieldName : this.fieldName;
this.fieldReset = options.fieldReset != null ? options.fieldReset : this.fieldReset;
this.previewUrl = options.previewUrl != null ? options.previewUrl : this.previewUrl;
this.calculateSpeed = options.calculateSpeed != null ? options.calculateSpeed : this.calculateSpeed;
if (!this.multiple) {
Expand Down

0 comments on commit 661cd09

Please sign in to comment.