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)
}