Who knows if the dog that bit you had been beaten up before causing it to be afraid of human 'aggression?'
A well socialised dog will not usually bite other dogs or humans unless it is attacked and fears for its life
A nervous dog, a brutalised dog, an unsocialised dog without good leadership (from humans) or the pack will automatically react to any kind of threat with nervous aggression (in its eyes prevention is better than cure)
Your overexcited shouting and flailing will have immediately put the dog on full alert and frightened it. Dogs are dogs, they are not human.