由于某种原因,此东西不起作用。我可以使用它不确定的模式。它表现出来,并尽其所能。但是我需要向用户展示该过程中的位置的值。
这是我的HTML
<mat-progress-spinner *ngIf='ShowLoader'
class="progressSpinner"
[color]="myCustomColor"
[value]="myCustomValue"
[mode]="mode">
</mat-progress-spinner>
我的打字稿
myCustomColor = 'primary';
mode = 'determinate';
myCustomValue: number = 0;
然后在我的pageload函数上作为测试示例
pageload() {
this.ShowLoader = true;
for (let i = 0; i < 1000; i++) {
const num = ((i / 1000) * 100);
setTimeout(() => {
this.myCustomValue = num;
}, 500);
}
}
摆脱[模式]。使用以下内容:
<mat-progress-spinner *ngIf='ShowLoader'
class="progressSpinner"
[color]="myCustomColor"
[value]="myCustomValue">
</mat-progress-spinner>