As trainers, this is referred to as "Leash Reactivity" and defined as otherwise friendly dogs off leash, reactive on leash. It is important to teach your dog how to avoid distractions anywhere you may be by offering an alternative behavior such as the cue "Watch Me" and have the dog focus on you using high value treats (high value is defined by the dog) when distracted. Most commonly used by trainers may also be what we call counter-conditioning and desensitization to reduce dog reactivity.