how would I angularize this js function? I need it to use asynchronously. my understanding is .then and angular can do that.
function showResult(result) {
var lat = result.geometry.location.lat();
var long = result.geometry.location.lng();
$scope.vm.showroom.Longitude = long;
$scope.vm.showroom.Latitude = lat;
}
function GetLatitudeLongitude(callback, address) {
var address1 = address || '234 eisenhower avenue salt lake city';
// Initialize the Geocoder
var geocoder = new google.maps.Geocoder();
if (geocoder) {
geocoder.geocode({
'address': address1
}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
callback(results[0]);
}
});
}
}
$qservice in Angular docs.angularjs.org/api/ng/service/$q