You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ds-manish I actually had to look in the source code to refactor an array called messages in the flash-messages.component.js file. What's happening with that array is that it simply pushes each error message that is received, but they don't go away, because of the window timeout function that removes them after 2.5seconds as @moff already mentioned.
So what I did there is that I checked if the "options" array hasOwnProperty('timeout'). Whether or not it has that property is determined by the .show(msg, options) methods options object. That means you can either set a timeout or not. So basically window.setTimeout function is set only if you passed a timeout property to the options object. Okay, so this gives you more control over the defaults object. Moving on.
Next up is the messages array. What you should do there is simply assign the messages array to an empty array, then you push the new message. And now only the latest message will be shown. This worked for me, hope it works for you too.
Hi, the flash messages show multiple times, is there any way to display the latest flash message only.
The flash message gets piled up.
The text was updated successfully, but these errors were encountered: