Moses was a humble man (Numbers 12:3), and so he knew when to become angry and what to do with it, demonstrated when he spoke to the stubborn Pharaoh,
“‘And all these your servants shall come down to me and bow down to me, saying, “Get out, and all the people who follow you!” After that I will go out.’ Then he went out from Pharaoh in great anger” (Exodus 11:8).
Pharaoh’s refusal to let Israel go and how that stubbornness brought on the plagues that almost destroyed Egypt forever, caused Moses to say that another and final plague was on its way, and then the Egyptians would beg Moses and Israel to leave.
The humility of Moses led him to speak the word of God boldly and plainly, and by delivering the word of God rather than his own word, Moses knew what would happen, leading the Egyptians to humble themselves before him.
As Moses delivered this message, and left the presence of Pharaoh in anger. Moses was angry, but he did not sin.To have anger as he did, we have to be humble and put everything in the context of God, and then we will be angry at the right time, and we will limit our anger so that we do not lose control.