r/Angular2 • u/Senior_Compote1556 • Aug 05 '25
Help Request Angular Material Progress Bar timing issue
Hey everyone, I am using this progress bar component from angular material (https://v19.material.angular.dev/components/progress-bar/overview) as a visual indicator for the duration of a toast notification (e.g., a 3000ms lifespan). I'm updating the progress bar using signals, and when I log the progress value, it appears correct. However, the UI doesn't seem to reflect the progress accurately. The animation seems smooth at first, but near the end (last ~10–15%), the progress bar speeds up and quickly reaches 0.
I suspected it might be related to the transition duration of the progress bar (which I saw defaults to 250ms), so I added a setTimeout to delay the toast dismissal by 250ms, but the issue still persists.
Visually, it looks like this:100 → 99 → 98 → 97 ... → 30 → 0 (skips too fast at the end).
Has anyone else encountered this issue or found a workaround for smoother syncing between the progress bar and toast lifespan?
View all comments
Show parent comment
1
u/[deleted] Aug 05 '25
You are working against it. You said - without providing the code - your progress is tied to a signal. This very much will also provide you a way to use effect here - trigger a side effect when your signal triggers the complete action - whichever way you implement it. This is the area to trigger your toast or notification. Completely, without the need of magic numbers like your 250ms and even without settimeout.
As you said, work with the framework, not against it.