Anger is an emotion with a very short fuse. It can ramp up and take over our faculties in a flash. But it also abates over time.
One way I have found to get a better handle on my anger is to take a deep breath just as I feel a sudden onslaught of emotion. Regardless of how justified or self righteous I feel in that moment, I still take that pause. This technique helps me ride out the initial outburst of emotion and come down to a less heightened state.
If my spontaneous judgement was wrong, it ensures that I don’t say anything impulsively that I may later regret. And in the case where my opinions don’t change, I still calm down enough to frame my response in a more productive manner.
Anger, even the self-righteous kind, is useful only when we harness it to change the situation through deliberate rational action, never impulsive words or reactions.