Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic progress bar in Ionic 4?

So I'm trying to build a progress bar that every time the user press a button the progress bar adds +1%.

html

<ion-button *ngFor="let progress of progress" (click)="add(progress)">Progress</ion-button>
<ion-progress-bar value={{progress}} buffer={{buffer}}></ion-progress-bar>

component file

add(progress){
    this.progress = progress + 1;

  }

For some reason the button is not showing but Logcat show no erros. Am I doing something wrong?

like image 474
rzp Avatar asked Jun 08 '26 05:06

rzp


1 Answers

Try

public progress = 1;
public increaseProgress(){
  this.progress = this.progress + 1; 
}
<ion-button (click)="increaseProgress()">Progress</ion-button>
<ion-progress-bar value={{progress}}></ion-progress-bar>
like image 160
Khurshid Ansari Avatar answered Jun 10 '26 06:06

Khurshid Ansari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!