Angular Mat Progress Spinner 模块未更新值

Cod*_*n03 1 progress angular-material angular

由于某种原因,这件事不起作用。我可以很好地使用它不确定的模式。它显示和旋转,因为它应该。但是我需要向用户展示它在过程中所处的位置的价值。

这是我的 HTML

<mat-progress-spinner *ngIf='ShowLoader'
class="progressSpinner"
[color]="myCustomColor"
[value]="myCustomValue"
[mode]="mode">
</mat-progress-spinner>
Run Code Online (Sandbox Code Playgroud)

我的打字稿

myCustomColor = 'primary';
mode = 'determinate';
myCustomValue: number = 0;
Run Code Online (Sandbox Code Playgroud)

然后在我的页面加载功能上作为测试示例

pageload() {
    this.ShowLoader = true;

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

       const num = ((i / 1000) * 100);
      setTimeout(() => {
        this.myCustomValue = num;
      }, 500);
    }
}
Run Code Online (Sandbox Code Playgroud)

Tan*_*jee 5

摆脱[模式]。使用以下内容:

<mat-progress-spinner *ngIf='ShowLoader'
class="progressSpinner"
[color]="myCustomColor"
[value]="myCustomValue">
</mat-progress-spinner>
Run Code Online (Sandbox Code Playgroud)