Most importantly, you need to stay calm. If you get emotional and angry, you won't be able to discipline appropriately. Tell the child what you want with words. Role play with your child. Pretend the two of you are fighting over a toy and that you are going to bite her.
Role play again.
Pretend you are fighting over a toy and let her try whatever she suggested to do instead of biting. Hurting a child does not help her learn to stop hurting others. This is a tough situation and requires you to be consistent and on top of the situation. My 18 month old granddaughter has mood swings. One moment she is playing fine, the next she cries out and gets mad.