Sometimes anger can be good. The Prophet never got angry except when the commandments of Allah were violated. However, if we do feel anger for the sake of Allah, we should make sure that we are not actually getting angry for our own ego or interests. We should express the anger in the right way; just because the anger is for the right cause does not give anyone license to behave badly. There should also be some benefit in the anger. If expressing the anger leads to more harm than benefit, then it should be avoided based on the principle of weighing benefit and harm. For example, when giving advice: say it in a good way, use good words and the best manners, and be careful not to escalate into a quarrel.