Toddler biting himself and leaving marks

My almost 2 year old had been having temper tantrums that legitimately scare me. It took 10 minutes to put his diaper on and he was screaming like someone was killing him. He dialed his body so much i couldn't get it on him. He would stop and slam his head into things. Then he bit himself so hard he left teeth marks in his hand that are still there. They have been getting worse and he he's been biting himself more. I know the best thing is to ignore but he really hurts himself when he slams his head into the table or a wall and bites himself so hard to leave marks. And it's hard to ignore when I have to get him dressed. advice?