What you did worked for me too, but only for the first couple of times...:-(
the few times after that, the dog ignored me, ran swiftly by me, and leapt at my dog! So beware...
My dog defended himself well, growling, teeth bared, head-on...and then owner dragged other dog away, so no harm done.
The owner always promised it would never happen again.
However when the other dog began to bite his owner on the leash-holding hand to get him to drop the leash,
that's when I gave up and called Animal Control.
| didn't want to spend my life walking in my own neighborhood with a can of Halt (they live just 3 houses down)
and I was fed up after 5 offleash attacks and this dog rattling the windows and door every time we walked by.
After the visit from Animal Control, they got much better at controlling their dogs, and things are quiet/OK now!
sigh, but that's what it took.
Rumo ~ rescue shepherd/husky mix