Я использую приведенный ниже код для привязки пункта отправления и пункта назначения - широты и долготы. После получения источника (текущего местоположения) и пункта назначения (я получаю значения от щелчка маркером) я передаю параметры в URL и пытаюсь открыть новую вкладку. Проблема в том, что параметры не передаются в URL карты Google.
getDirection(dirLat: any, dirLng: any) {
let srcLat, srcLng;
if ('geolocation' in navigator) {
navigator.geolocation.getCurrentPosition((position) => {
srcLat = position.coords.latitude;
srcLng = position.coords.longitude;
});
}
this.dir = {
origin: { latitude: 29.9809683, longitude: 31.3377553 },
destination: { latitude: dirLat, longitude: dirLng }
};
// prints the values correctly for origin and destination{latitude: 29.9809683, longitude: 31.3377553}
console.log('originDest', this.dir.origin, this.dir.destination);
//in the below url, dir.origin and dir.destination does not get the values
window.open('https://www.google.com/maps/dir/?api=1&origin={{dir.origin}}&destination={{dir.destination}}&travelmode=driving', '_blank');
}