Skip to content

Commit

Permalink
Dynamic options parameter binding (bleenco#84)
Browse files Browse the repository at this point in the history
This changes will allow to bind options parameter dynamically. For
example, when we use dynamic URLs
  • Loading branch information
YaroslavOsetrov authored and jkuri committed Sep 13, 2016
1 parent d74b8d0 commit fdb99b1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/directives/ng-file-drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,23 @@ import {Ng2Uploader} from '../services/ng2-uploader';
selector: '[ngFileDrop]'
})
export class NgFileDropDirective {
@Input() options: any;

@Input() events: EventEmitter<any>;
@Output() onUpload: EventEmitter<any> = new EventEmitter();
@Output() onPreviewData: EventEmitter<any> = new EventEmitter();

_options:any;

get options(): any {
return this._options;
}

@Input('options')
set options(value: any) {
this._options = value;
this.uploader.setOptions(this.options);
}

files: any[] = [];
uploader: Ng2Uploader;

Expand Down
14 changes: 13 additions & 1 deletion src/directives/ng-file-select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ import { Ng2Uploader } from '../services/ng2-uploader';
selector: '[ngFileSelect]'
})
export class NgFileSelectDirective {
@Input() options: any;

@Input() events: EventEmitter<any>;
@Output() onUpload: EventEmitter<any> = new EventEmitter();
@Output() onPreviewData: EventEmitter<any> = new EventEmitter();

_options:any;

get options(): any {
return this._options;
}

@Input('options')
set options(value: any) {
this._options = value;
this.uploader.setOptions(this.options);
}

files: any[] = [];
uploader: Ng2Uploader;
Expand Down

0 comments on commit fdb99b1

Please sign in to comment.