Is there a way to dynamically adjust the fill value of an Angular Material Progress Bar?
In CSS, I can achieve this with:
::ng-deep .mat-progress-bar-fill::after {
background-color: red;
}
However, since the value needs to be dynamic, I am unable to do this in CSS.
I attempted to use -
(document.querySelector('.mat-progress-bar-fill::after') as HTMLElement).style.background = 'green';
but it resulted in an error: ERROR TypeError: Cannot read properties of null (reading 'style')
Interestingly, I was able to set the background color of .mat-progress-bar-buffer
using the same method -
(document.querySelector('.mat-progress-bar-buffer') as HTMLElement).style.backgroundColor = 'red';
Therefore, my question is how can I select and manipulate .mat-progress-bar-fill::after
using document.querySelector
? Or, is there a different approach to dynamically setting the fill bar within an Angular component?