app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
progress:number = 0;
timer: any;
onClick(){
this.progress = 0;
this.timer = setInterval(() => this.updateProgress(), 300)
}
updateProgress(){
this.progress++
if(this.progress>=100)
{
clearInterval(this.timer);
}
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - How to use Progressbar
</h4>
<button (click)="onClick()">Run Task</button>
<br/><br/>
<h5>Progress : {{progress+'%'}}</h5>
<p>
<ngb-progressbar type="success" [value]="progress">
</ngb-progressbar>
</p>
- angular - How to use if then condition
- angular - Loop through an array of objects
- angular - How to use nested loop
- angular - How to use Button click event
- angular - How to call function on Button click
- angular - How to use ternary operator
- angular - How to generate random number
- angular - How to toggle element visibility
- angular bootstrap - How to show an alert
- angular bootstrap - How to use Collapse
- angular bootstrap - How to use Rating
- angular bootstrap - Show text inside Progressbar
- angular bootstrap - Progressbar maximum value
- angular bootstrap - How to show striped Progressbar
- angular bootstrap - Light & dark Progressbar