I got a small app that use the Direction Service feature of Google Map. It is working well, I can change routes, but I have a small problem, where a user could go back to a
I had similar problem, I tried with directionsDisplay.setMap(null); but it didn’t work.
The problem was the directionsDisplay object which I created was declared locally.
I changed it to global and every time the function is called, it will use the same global directionsDisplay object and make changes to it. This will definitely remove the previous route displayed on same object.