<button ejs-progressbutton #progressButton content="Spin Left" (progress)='onProgress($event)'></button>
<button ejs-button content="Stop Progress" (click)="btnClick()"></button> |
export class ProgressButtonController {
@ViewChild('progressButton') progressButton: ProgressButtonComponent;
public isDataArrived: boolean = false;
public onProgress(args: ProgressEventArgs){
if(this.isDataArrived){
//To stop the spinner
args.percent = 100;
this.isDataArrived = false;
}
else {
//Duration will be increased if button is not clicked
this.progressButton.duration = this.progressButton.duration + 1000;
}
}
btnClick(){
this.isDataArrived = true;
}
} |