There are two things to remember about biblical anger. First, its design. Jesus' anger was righteous indignation at how God was being dishonored by the Pharisees and how the temple was being used. Anger at unrighteousness and injustice is not sinful. Second, the duration of anger. Anger is an emotion that leads to action. But when anger is nurtured into bitterness and resentment, it becomes self-serving and sinful. That is why Paul used the psalmist's words to remind the Ephesians not to take their anger to bed.

If you are feeling angry, examine the design of your anger and keep its duration short. Otherwise, anger can become a foothold for the devil (Ephesians 4:26-27).
To be angry against sin is a high and holy thing.
Charles H. Spurgeon