Hello everybody !
I encounter difficulties for use the result of request from directionService.
i will try to explain :
i have function which need return a “trip”. For build this “trip” i need to use the params of “createTrip” function and the result of directionService.rout() from google map direction service API (https://developers.google.com/maps/documentation/javascript/directions?hl=en)
createTrip(someParams) {
var trip = {};
directionsService.route(
options,
function(result, status: any) {
console.log('this', this);
if (status === 'OK') {
console.log('result', result);
// directionsDisplay.setDirections(result);
}
}
);
trip['attr1'] = someParams[...]
trip['attr2'] = someParams[...]
trip['attr3'] = [ **HERE I NEED USE PROPERTY OF THE RESULT FROM DIRECTIONSERVICE**]
return trip;
}
i think i need to wait asynchronous the result of the request for build my trip object, but i failed…
Someone have any idea ?? Thanks =)