1
retonaEndereco(myLatlng,adress => {
let getDistance = function (origin,destination) {
let distance = geolib.getDistance(origin,destination);
return geolib.convertUnit('km',distance);
}
var getAllDistances = function ()
{
// var dados = dadosEndereco;
let distanciaCalc = getDistance(
{latitude:-23.624467,
longitude:-46.731728},
{latitude:adress.geometry.location.lat(),
longitude:adress.geometry.location.lng()}
)
return parseFloat(distanciaCalc).toFixed(2);
}
var km = getAllDistances;
var dadosEndereco = {
"Rua/Avenida": adress.address_components[0].long_name,
"Bairro" : adress.address_components[1].long_name,
"Cidade" : adress.address_components[3].long_name,
"UF" : adress.address_components[4].short_name,
"km" : km
};
this.returnDados(dadosEndereco);
});
});
}
private returnDados (dados){
this.nav.push(NovoPedidoPage,dados)
}
Welcome to Stackoverflow! Please explain the problem better, and if possible include a example of code that reproduces what is happening, because your question is not noticeable. See Help Center How to Ask.
– Taisbevalle