Change the text content and styles of the progressbutton during progress in Angular Progress button component
15 Sep 20222 minutes to read
You can change the text content and styles of the ProgressButton during progress by changing the text content and the cssClass
property at the begin
and end
events.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `<!-- To render progress button. -->
<button ejs-progressbutton [content]='content' [cssClass]='cssClass' [enableProgress]='true' [duration]='4000' (begin)='begin()' (end)='end()'></button>`
})
export class AppComponent {
private content: string = 'Upload';
private cssClass: string = 'e-hide-spinner';
private begin(): void {
this.content = 'Uploading...';
this.cssClass = 'e-hide-spinner e-info';
}
private end(): void {
this.content = 'Success';
this.cssClass = 'e-hide-spinner e-success';
setTimeout(() => {
this.content = 'Upload';
this.cssClass = 'e-hide-spinner';
}, 500)
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ProgressButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { AppComponent } from './app.component';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule,
ProgressButtonModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);