javascript - latitude and longitude not saved google maps api -


i'm trying latitude , longitude address google maps api , don't how. map working getting address there way address take lat , lon? following code working:

 <ng-map default-style="false" zoom="16" center="{{ '{{ getaddress() }}' }}" style="width: 100%; height: 430px;">                 <marker centered="true" position="{{ '{{ getmarkerposition() }}' }}" draggable="true" on-dragend="onmarkerdragend($event)"></marker>                 <shape ng-if="showregions" ng-repeat="shape in regions"                         (...)                 </shape>  </ng-map> 

and js:

 $scope.getmarkerposition = function () {             if (!$scope.address.mappinlocationlatitude || !$scope.address.mappinlocationlongitude) {                 return $scope.getobjectiveaddress();             }              return [$scope.address.mappinlocationlatitude, $scope.address.mappinlocationlongitude]         }; 

the problem mappinlocationlatitude , long null, in database not salved , don't know why..

   $scope.getaddress = function () {             var address = "..."; (here concatenate string address values(street, number, etc , returned)              return streetstring + ', ' + address;         };        $scope.onmarkerdragend = function ($event) {             $scope.address.mappinlocationlatitude = $event.latlng.lat();             $scope.address.mappinlocationlongitude = $event.latlng.lng();             $scope.updateregions();         }; 

so, question is, idea how latitude , long , example if write: map displayed correctly?

 <marker centered="true" position="{{ '{{ [address.mappinlocationlatitude, address.mappinlocationlongitude]}}' }}" draggable="true" on-dragend="onmarkerdragend($event)"></marker> 

use geocoding service

example

$.getjson( { url  : 'https://maps.googleapis.com/maps/api/geocode/json', data : {     sensor  : false,     address : address }, success : function( data, textstatus ) {     console.log( textstatus, data ); } 

} );

similar question on stack here


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -