Of course you're not messing up the parenting thing; all our kids do this in one form or another.
Okay - so if you think she's doing it for attention, show her that she won't get it if she behaves in this way.
My mum always said that ignoring me when I was naughty really worked because it was her attention I wanted and if I behaved badly, she would take any attention away from me until I behaved.
now I know you're dd is only 2 but if she's able to understand and speak like a 3 yr old, then you could say:
"dd, I'm not going to chat to you until you calm down/behave and turn away from her and leave the room". When she comes after you (as she likely will) keep ignoring her and turning away until she says she can be good.
With mine, I did the cause and effect speech every time they misbehaved at that age:
"dd/ds, if you do a,b and c, you will not get d". and
" if you behave nicely, then we can go for a walk/read a story but I will not read a story until you calm down" etc.
"If you cry/scream at me, I will not talk to you" Then follow through and don't talk to her.
Also - when your dh is there, ask him to take over some routine and responsibilities, even if it's simply reading a story/ going for a walk with her. If she's not with you 24/7, she will repsect you more and you won't resent her behaviour as much.