Access variable out of function [duplicate]

0

I need to access the variable vm.lat outside the POST below. What could I do to achieve?

var lat
var lng

$http.post(url)
  .then(function(resp) {
      vm.enderecoFull = resp.data
      vm.geometry = vm.enderecoFull[0].geometry
      vm.location = vm.geometry.location
      lat = vm.location.lat 
      lng = vm.location.lng
  }, function (error) {
     console.log("Erro")
  })

console.log("lat: ", lat)
    
asked by anonymous 31.05.2018 / 04:34

0 answers