My dog tried attacking someone.

Hey ladies. I’m not sure where to post this and I figured since there’s so many people on here at least a couple people could help me out. I have a 1 1/2 year old pit bull she is the sweetest thing I have ever met and I love her to death. She has never been aggressive with anyone she loves people, I’ve had her since she was 4 months old and not once has she growled or snapped at someone. About two weeks ago I took her to the vet because she had an ear infection, she’s been to the vet a couple times before that and she’s always a bit scared and nervous but her tail still wags like crazy and she take the treats the vet offers, she has never growled at a vet. Two weeks ago when I took her it was just like that, things went perfect, even when they stuck the things down her ears, and listened to her heart, she was scared, but good. Today I had to take her in for a check up on her ears and I also wanted to talk to the vet about getting her fixed because we haven’t done that yet. Everything was fine, she was acting how she normally would at the vet, they but that thing in one of her ears, fine, gave her a treat, but then the vet went to put it in her other ear, and my dog just went crazy. She was trying to attack the vet, thank god i was able to hold her back. I have never seen her that way I was absolutely terrified but I just had to hold her back. I have never heard her bark and growl the way she did it was the worst thing I’ve ever heard, she even tried to go after my mom. She didn’t stop until everyone left the room and it was just me and her. When the vets left the room she was perfectly fine she was like happy wagging her tail trying to lick me while I just sat there terrified and crying. I’ve witnessed two dog fights and been bit once, still have never been scared of dogs especially my own. But right now I am scared. I feel horrible that I’m scared, she’s my baby but I have no idea what to do. I’m at home now crying my eyes out. I don’t know what to do with her. I scared this will happen again but she actually end up biting someone. I babysit my nieces and nephews a lot so she’s around children all the time god forbid she tried attacking one of them, I have another dog and two cats as well. I feel like I can’t bring her around people anymore. The vet told me when we come back to get her fixed we need to put a muzzle on her. I hate that I need to do that to my baby. I’m so confused right now. Also sorry I’m not sure what group to post this in

I see most who have commented are saying her ear is probably in pain but I don’t think it is? We’re been having to rub medicine in her ears the past two weeks and she has been fine with it, she had a yeast infection which is completely gone now so I don’t know if she was in pain. She does have sensitive ears, sometimes I’ll be playing with them and accidentally kind of pull on one and she’ll just yap but not aggressively. The vet also barely had touched her.