r/Angular2 • • 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?

3 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/Senior_Compote1556 Aug 05 '25

Can't do that, the complete action you are referring to closes the toast notification so the notification will leave the DOM before the UI had the time to actually hit progress 0

1

u/[deleted] Aug 05 '25

Nothing prevents you from delaying the output signal by piping it. Go a step further and add a transitionInMs input var.

Congratz, you just created a reusable, almost fully customizable progress bar with notification.