Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. <ng-map default-style="false" zoom="16" center="{{ '{{ getAddress() }}' }}" style="width: 100%; height: 430px;">
  2. <marker centered="true" position="{{ '{{ getMarkerPosition() }}' }}" draggable="true" on-dragend="onMarkerDragEnd($event)"></marker>
  3. <shape ng-if="showRegions" ng-repeat="shape in regions"
  4. (...)
  5. </shape>
  6. </ng-map>
  7.  
  8. $scope.getMarkerPosition = function () {
  9. if (!$scope.address.mapPinLocationLatitude || !$scope.address.mapPinLocationLongitude) {
  10. return $scope.getObjectiveAddress();
  11. }
  12.  
  13. return [$scope.address.mapPinLocationLatitude, $scope.address.mapPinLocationLongitude]
  14. };
  15.  
  16. $scope.getAddress = function () {
  17. var address = "..."; (here just concatenate the string with the address values(street, number, etc and it returned)
  18.  
  19. return streetString + ', ' + address;
  20. };
  21.  
  22.  
  23. $scope.onMarkerDragEnd = function ($event) {
  24. $scope.address.mapPinLocationLatitude = $event.latLng.lat();
  25. $scope.address.mapPinLocationLongitude = $event.latLng.lng();
  26. $scope.updateRegions();
  27. };
  28.  
  29. <marker centered="true" position="{{ '{{ [address.mapPinLocationLatitude, address.mapPinLocationLongitude]}}' }}" draggable="true" on-dragend="onMarkerDragEnd($event)"></marker>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement