app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
isDisable:boolean = false;
progress:number = 0;
timer:any;
maxValue:number = 100;
onClick(){
this.progress = 0;
this.isDisable = true;
this.timer = setInterval(() => this.updateProgress(), 300)
}
updateProgress(){
this.progress++
if(this.progress>=this.maxValue){
clearInterval(this.timer);
}
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to use determinate Progress spinner
</h2>
<button
mat-raised-button
color="accent"
(click)="onClick()"
[disabled]="isDisable"
style="margin-bottom:30px;">
Run Task
</button>
<h3 *ngIf="isDisable">Progress : {{progress}}</h3>
<mat-progress-spinner
mode="determinate"
[value]="progress">
</mat-progress-spinner>
app.module.ts [import]
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'
import {MatButtonModule} from '@angular/material/button'



- angular material - How to use indeterminate Progress spinner
- angular - How to use setTimeout()
- angular material - Progress spinner with percentage
- angular material - How to change Progress spinner size
- angular material - How to delete Tab programmatically
- angular material - How to show remove button on Tab label
- angular material - How to show Tab label bottom of content
- angular material - How to show thumb label in Slider
- angular material - Slider custom formatted thumb label
- angular material - How to use Slider change event
- angular material - How to change Badge size
- angular material - How to use custom Badge size
- angular material - How to show custom color in Badge
- angular material - How to show Badge with icon
- angular material - Badge position before & below after