app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: [`
/deep/ .mat-progress-bar{
height: 25px !important;
border-radius: 25px;
}
`]
})
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(), 100)
}
updateProgress(){
this.progress++
if(this.progress>=this.maxValue){
clearInterval(this.timer);
this.isDisable = false;
}
}
}
app.component.html
<h2 style="padding-top:25px; padding-bottom:25px;">
Angular Material - How to change Progress bar height
</h2>
<button
mat-raised-button
color="primary"
(click)="onClick()"
[disabled]="isDisable"
style="margin-bottom:30px;">
Run Task
</button>
<h3>Progress : {{progress}}</h3>
<mat-progress-bar
mode="determinate"
[value]="progress">
</mat-progress-bar>
app.module.ts [import]
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatButtonModule} from '@angular/material/button'
- angular - How to use clearInterval()
- angular material - Show custom color in Progress bar
- angular material - How to change Divider color
- angular material - How to change Progress bar width
- angular material - How to use Card
- angular material - How to use Tabs
- angular material - How to use custom label in Tabs
- 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 use vertical Slider
- angular material - How to change Slider width
- angular material - Tick interval auto in Slider
- angular material - Slider custom formatted thumb label
- angular material - How to use Slider change event