Skip to content

Commit

Permalink
ref to component
Browse files Browse the repository at this point in the history
  • Loading branch information
AckerApple committed Aug 31, 2017
1 parent 5f15e53 commit 329098f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion demo/www/index.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/file-upload/file-drop.directive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ export declare class FileDropDirective {
uploader: FileUploader;
fileOver: EventEmitter<any>;
onFileDrop: EventEmitter<File[]>;
ref: any;
refChange: EventEmitter<{}>;
protected element: ElementRef;
constructor(element: ElementRef);
ngOnInit(): void;
getOptions(): any;
getFilters(): any;
onDrop(event: any): void;
Expand Down
6 changes: 6 additions & 0 deletions dist/file-upload/file-drop.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ var FileDropDirective = /** @class */ (function () {
this.uploader = new file_uploader_class_1.FileUploader({});
this.fileOver = new core_1.EventEmitter();
this.onFileDrop = new core_1.EventEmitter();
this.refChange = new core_1.EventEmitter();
this.element = element;
}
FileDropDirective.prototype.ngOnInit = function () {
this.refChange.emit(this); //create reference to this class
};
FileDropDirective.prototype.getOptions = function () {
return this.uploader.options;
};
Expand Down Expand Up @@ -85,6 +89,8 @@ var FileDropDirective = /** @class */ (function () {
'uploader': [{ type: core_1.Input },],
'fileOver': [{ type: core_1.Output },],
'onFileDrop': [{ type: core_1.Output },],
'ref': [{ type: core_1.Input },],
'refChange': [{ type: core_1.Input },],
'onDrop': [{ type: core_1.HostListener, args: ['drop', ['$event'],] },],
'onDragOver': [{ type: core_1.HostListener, args: ['dragover', ['$event'],] },],
'onDragLeave': [{ type: core_1.HostListener, args: ['dragleave', ['$event'],] },],
Expand Down
2 changes: 1 addition & 1 deletion dist/file-upload/file-drop.directive.metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"__symbolic":"module","version":3,"metadata":{"FileDropDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ng2FileDrop]"}]}],"members":{"uploader":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"fileOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onFileDrop":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"getOptions":[{"__symbolic":"method"}],"getFilters":[{"__symbolic":"method"}],"onDrop":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["drop",["$event"]]}]}],"onDragOver":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragover",["$event"]]}]}],"onDragLeave":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragleave",["$event"]]}]}],"_getTransfer":[{"__symbolic":"method"}],"_preventAndStop":[{"__symbolic":"method"}],"_haveFiles":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"FileDropDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ng2FileDrop]"}]}],"members":{"uploader":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"fileOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onFileDrop":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"getOptions":[{"__symbolic":"method"}],"getFilters":[{"__symbolic":"method"}],"onDrop":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["drop",["$event"]]}]}],"onDragOver":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragover",["$event"]]}]}],"onDragLeave":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragleave",["$event"]]}]}],"_getTransfer":[{"__symbolic":"method"}],"_preventAndStop":[{"__symbolic":"method"}],"_haveFiles":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":3,"metadata":{"FileDropDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ng2FileDrop]"}]}],"members":{"uploader":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"fileOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onFileDrop":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"ref":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"refChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"getOptions":[{"__symbolic":"method"}],"getFilters":[{"__symbolic":"method"}],"onDrop":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["drop",["$event"]]}]}],"onDragOver":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragover",["$event"]]}]}],"onDragLeave":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragleave",["$event"]]}]}],"_getTransfer":[{"__symbolic":"method"}],"_preventAndStop":[{"__symbolic":"method"}],"_haveFiles":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"FileDropDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive"},"arguments":[{"selector":"[ng2FileDrop]"}]}],"members":{"uploader":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"fileOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"onFileDrop":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"ref":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"refChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"getOptions":[{"__symbolic":"method"}],"getFilters":[{"__symbolic":"method"}],"onDrop":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["drop",["$event"]]}]}],"onDragOver":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragover",["$event"]]}]}],"onDragLeave":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["dragleave",["$event"]]}]}],"_getTransfer":[{"__symbolic":"method"}],"_preventAndStop":[{"__symbolic":"method"}],"_haveFiles":[{"__symbolic":"method"}]}}}}]
7 changes: 7 additions & 0 deletions src/file-upload/file-drop.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ export class FileDropDirective {
@Input() public uploader:FileUploader = new FileUploader({});
@Output() public fileOver:EventEmitter<any> = new EventEmitter();
@Output() public onFileDrop:EventEmitter<File[]> = new EventEmitter<File[]>();

@Input() public ref:any
@Input() public refChange = new EventEmitter()

protected element:ElementRef;

public constructor(element:ElementRef) {
this.element = element;
}

public ngOnInit(){
this.refChange.emit(this)//create reference to this class
}

public getOptions():any {
return this.uploader.options;
}
Expand Down

0 comments on commit 329098f

Please sign in to comment.