I am trying to prepend some text into the start_address property which is returned in the DirectionsLeg object.. I want to associate business names with these waypoints in the returned directions.
For some reason, and I'm not ruling out developer error here, only the first leg is being updated. . I've dumbed down the code as much as I can to test this out. My code is as follows:
response.routes[0].legs[0].start_address = 'Store # 0: ' + response.routes[0].legs[0].start_address;
response.routes[0].legs[1].start_address = 'Store # 1: ' + response.routes[0].legs[1].start_address;
response.routes[0].legs[2].start_address = 'Store # 2: ' + response.routes[0].legs[2].start_address;
response.routes[0].legs[3].start_address = 'Store # 3: ' + response.routes[0].legs[3].start_address;
response.routes[0].legs[4].start_address = 'Store # 4: ' + response.routes[0].legs[4].start_address;
response.routes[0].legs[5].start_address = 'Store # 5: ' + response.routes[0].legs[5].start_address;
response.routes[0].legs[6].start_address = 'Store # 6: ' + response.routes[0].legs[6].start_address;
response.routes[0].legs[7].start_address = 'Store # 7: ' + response.routes[0].legs[7].start_address;
directionsDisplay.setDirections(response);
My directions, however, come out this way... See attachment. Only the first (element 0) address is shown with the updated text. The remaining legs remain unchanged.
I am not returning multiple routes (provideRouteAlternatives is false), so there is only one route with multiple legs from start, to each waypoint, to the end point. I am not sure what I'm missing, please advise?
Thanks,