The ProgressBar component for Angular represents a widget that visually indicates the progress of a lengthy operation.
npm install -g @angular/cli ng new jqwidgets-project cd jqwidgets-project
ng add jqwidgets-ng
jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package
npm install jqwidgets-ng
@import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';
"styles": [ "node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css" ]
<div style="font-size: 13px; font-family: Verdana; float: left;">
<div style="margin-top: 10px;">Horizontal</div>
<jqxProgressBar [theme]="'fluent'" #horizontal
[width]="250" [height]="30" [value]="50">
</jqxProgressBar>
<div style="margin-top: 10px;">Vertical</div>
<jqxProgressBar [theme]="'fluent'" #vertical
[width]="30" [height]="250" [value]="50" [orientation]="'vertical'">
</jqxProgressBar>
<br />
<div>Enter a value between 0 and 100</div>
<jqxInput [theme]="'fluent'" #ValueInput></jqxInput>
<!--<input id="ValueInput" type="text" style="margin-top: 5px;" />-->
<jqxButton [theme]="'fluent'" (onClick)="onClick()">Update</jqxButton>
<jqxCheckBox [theme]="'fluent'" (onChange)="onCheckBox($event)">
Show Progress Text
</jqxCheckBox>
<jqxCheckBox [theme]="'fluent'" (onChange)="onCustomTextCheckBox($event)">
Custom Progress Text
</jqxCheckBox>
</div>
import { Component, ViewChild, ElementRef } from '@angular/core';
import { jqxButtonComponent, jqxButtonModule } from 'jqwidgets-ng/jqxbuttons';
import { jqxInputComponent, jqxInputModule } from 'jqwidgets-ng/jqxinput';
import { jqxRadioButtonComponent, jqxRadioButtonModule } from 'jqwidgets-ng/jqxradiobutton';
import { jqxProgressBarModule, jqxProgressBarComponent } from 'jqwidgets-ng/jqxprogressbar';
@Component({
selector: 'app-root',
imports: [jqxProgressBarModule, jqxRadioButtonModule, jqxInputModule, jqxButtonModule],
standalone: true,
templateUrl: './app.component.html'
})
export class AppComponent {
@ViewChild('horizontal') myHorizontalProgressBar: jqxProgressBarComponent;
@ViewChild('vertical') myVerticalProgressBar: jqxProgressBarComponent;
@ViewChild('ValueInput') ValueInputElement: jqxInputComponent;
valueInput: number;
isUpdated: boolean = false;
renderText(text: string): string {
return "<span class='jqx-rc-all' style='background: #ffe8a6; color: #e53d37; font-style: italic;'>" + text + "</span>";
}
getValueInput(): number {
return parseInt(this.ValueInputElement.val());
}
//display: none;
onClick(): void {
let value = this.getValueInput();
if (!isNaN(value)) {
this.valueInput = value;
this.myHorizontalProgressBar.val(value);
this.myVerticalProgressBar.val(value);
this.isUpdated = true;
}
}
onCheckBox(event: any): void {
let value = this.getValueInput();
if (value != null && this.isUpdated) {
this.myHorizontalProgressBar.value(this.valueInput);
this.myVerticalProgressBar.value(this.valueInput);
}
let isChecked = event.args.checked;
this.myHorizontalProgressBar.showText(isChecked);
this.myVerticalProgressBar.showText(isChecked);
}
onCustomTextCheckBox(event: any): void {
let value = this.getValueInput();
if (value != null && this.isUpdated) {
this.myHorizontalProgressBar.value(this.valueInput);
this.myVerticalProgressBar.value(this.valueInput);
}
if (event.args.checked) {
this.myHorizontalProgressBar.renderText(this.renderText);
this.myVerticalProgressBar.renderText(this.renderText);
}
else {
this.myHorizontalProgressBar.renderText(null);
this.myVerticalProgressBar.renderText(null);
}
}
}