[app.component.html]
<ejs-uploader #defaultupload id='defaultfileupload' [autoUpload]='false' [asyncSettings]='path' [dropArea]='dropElement' [buttons]="buttons" ></ejs-uploader>
[app.component.ts]
import { Component, ViewChild, ViewEncapsulation, Inject, AfterViewInit } from '@angular/core';
import { EmitType, detach, createElement } from '@syncfusion/ej2-base';
import { UploaderComponent, RemovingEventArgs, ClearingEventArgs } from '@syncfusion/ej2-angular-inputs';
import { createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
import { CheckBoxComponent } from '@syncfusion/ej2-angular-buttons';
/**
* Default Uploader Default Component
*/
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements AfterViewInit {
ngAfterViewInit() {
this.clearEle.onclick = function(){
console.log("click raised");
};
}
public path: Object = {
saveUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Save',
removeUrl: 'https://aspnetmvc.syncfusion.com/services/api/uploadbox/Remove'
};
public clearEle = createElement('span', { className: 'remove e-icons', innerHTML : 'Clear All'});
public buttons: Object = {
browse: 'Choose file',
clear: this.clearEle
};
public dropElement: HTMLElement = document.getElementsByClassName('control-fluid')[0] as HTMLElement;
constructor() {
}
}
|