1

For some reason this thing is not working. I can use it indeterminate mode fine. It shows and spins as it should. But I need to show the user's the value of where it is in the process.

This is my HTML

<mat-progress-spinner *ngIf='ShowLoader'
class="progressSpinner"
[color]="myCustomColor"
[value]="myCustomValue"
[mode]="mode">
</mat-progress-spinner>

My typescript

myCustomColor = 'primary';
mode = 'determinate';
myCustomValue: number = 0;

then on my pageload function just as a test example

pageload() {
    this.ShowLoader = true;

    for (let i = 0; i < 1000; i++) {

       const num = ((i / 1000) * 100);
      setTimeout(() => {
        this.myCustomValue = num;
      }, 500);
    }
}
CodeMan03
  • 570
  • 3
  • 18
  • 43
  • https://stackoverflow.com/questions/5226285/settimeout-in-for-loop-does-not-print-consecutive-values – yurzui Mar 24 '18 at 05:54

1 Answers1

5

Get rid of [mode]. use the following :

<mat-progress-spinner *ngIf='ShowLoader'
class="progressSpinner"
[color]="myCustomColor"
[value]="myCustomValue">
</mat-progress-spinner>
Tanmoy Bhattacharjee
  • 1,040
  • 11
  • 21