How to change text content and styles during progress in Angular Progress Button
14 Aug 20262 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 { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ProgressButtonModule } from '@syncfusion/ej2-angular-splitbuttons'
import { Component } from '@angular/core';
@Component({
imports: [
ProgressButtonModule
],
standalone: true,
selector: 'app-root',
template: `<div class="e-section-control">
<!-- To render progress button. -->
<button ejs-progressbutton [content]='content' [cssClass]='cssClass' [enableProgress]='true' [duration]='4000' (begin)='begin()' (end)='end()'></button></div>`
})
export class AppComponent {
public content: string = 'Upload';
public cssClass: string = 'e-hide-spinner';
public begin(): void {
this.content = 'Uploading...';
this.cssClass = 'e-hide-spinner e-info';
}
public end(): void {
this.content = 'Success';
this.cssClass = 'e-hide-spinner e-success';
setTimeout(() => {
this.content = 'Upload';
this.cssClass = 'e-hide-spinner';
}, 500)
}
}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));