I want to show a Progress Bar overlay while some processing takes place. I can calculate the percent complete so I want to use a determinate progress bar. For the overlay part, I want to use a dialog. Basically, I want to do exactly what is done here (Angular 2 Material Progress Spinner: display as overlay) except I do not want a Spinner. So my component will look like:
Template:
<mat-progress-bar mode="determinate" [value]="percent"></mat-progress-bar>
Component:
import {Component, Input} from '@angular/core';
@Component({
selector: 'progress-bar',
templateUrl: 'progress-bar.html'
})
export class ProgressBarComponent {
@Input() percent: number;
constructor() {}
}
And then my code that uses this component is like this:
const dialogRef: MatDialogRef<ProgressBarComponent> = this.dialog.open(ProgressBarComponent, {
panelClass: 'transparent',
disableClose: true
});
for (let i = 0; i < this.thingsToProcess.length; i++) {
percentDone = i / this.thingsToProcess.length;
// todo: Update dialogRef.ProgressBarComponent.percent
await this.myService.doProcessing(this.thingsToProcess[i]);
}
My question is how can I bind to the "percent" value that is on the ProgressBarComponent class?
I found this (How to pass data to dialog of angular material 2) but it seems like it is only for constructor injection and not binding.