I'm trying to update a field with a new geo code value, but even though the model is updated it is not binding with first call. My controller code is as follows:
function TheReportCtrl($scope) {
$scope.code = [];
$scope.code.lat = "19.2555500";
$scope.getCode = function () {
var geocoder = new google.maps.Geocoder();
var address = "12323 Barker Cypress Rd, Cypress, Texas"
geocoder.geocode({
'address': address
}, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
$scope.code.lat = results[0].geometry.location.k;
} else {
console.log("Geocoding failed: " + status);
}
});
}
}
What is the missing part of my code?