Commit 942356475a84783f141ca5a8b29c474222ea49a4
1 parent
89b5f90e00
Exists in
develop
Change
Codigo identado
Showing
2 changed files
with
49 additions
and
48 deletions
Show diff stats
src/js/osm-directive.js
1 | -angular.module('focaModalLocalizar').directive('osmDireccion', function() { | |
1 | +angular.module('focaModalLocalizar') | |
2 | + .directive('osmDireccion', function () { | |
2 | 3 | return { |
3 | - restrict: 'E', | |
4 | - link: function(scope, el, attrs) { | |
5 | - var contenedor = document.createElement('div'); | |
6 | - el.append(contenedor); | |
7 | - scope.map = L.map(contenedor).setView([-32.89214159952345, -68.84572999101856], attrs.zoom); | |
8 | - L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); | |
9 | - }, | |
10 | - controller: ['$scope', '$timeout', function($scope, $timeout) { | |
11 | - //resuelve bug mapa gris en modales | |
12 | - $timeout(function() { | |
13 | - $scope.map.invalidateSize(); | |
14 | - }, 100); | |
4 | + restrict: 'E', | |
5 | + link: function (scope, el, attrs) { | |
6 | + var contenedor = document.createElement('div'); | |
7 | + el.append(contenedor); | |
8 | + scope.map = L.map(contenedor).setView([-32.89214159952345, -68.84572999101856], attrs.zoom); | |
9 | + L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); | |
10 | + }, | |
11 | + controller: ['$scope', '$timeout', function ($scope, $timeout) { | |
12 | + //resuelve bug mapa gris en modales | |
13 | + $timeout(function () { | |
14 | + $scope.map.invalidateSize(); | |
15 | + }, 100); | |
15 | 16 | |
16 | - $scope.markers = []; | |
17 | - $scope.$watchGroup(['latitud', 'longitud'], function() { | |
18 | - for(var i in $scope.markers) { | |
19 | - $scope.map.removeLayer($scope.markers[i]); | |
20 | - } | |
21 | - $scope.markers.push( | |
22 | - L.marker([$scope.latitud, $scope.longitud], {draggable: true}) | |
23 | - .addTo($scope.map) | |
24 | - .on('dragend', function() { | |
25 | - $scope.latitud = this.getLatLng().lat; | |
26 | - $scope.longitud = this.getLatLng().lng; | |
27 | - $scope.$apply(); | |
28 | - }) | |
29 | - ); | |
30 | - }); | |
17 | + $scope.markers = []; | |
18 | + $scope.$watchGroup(['latitud', 'longitud'], function () { | |
19 | + for (var i in $scope.markers) { | |
20 | + $scope.map.removeLayer($scope.markers[i]); | |
21 | + } | |
22 | + $scope.markers.push( | |
23 | + L.marker([$scope.latitud, $scope.longitud], { draggable: true }) | |
24 | + .addTo($scope.map) | |
25 | + .on('dragend', function () { | |
26 | + $scope.latitud = this.getLatLng().lat; | |
27 | + $scope.longitud = this.getLatLng().lng; | |
28 | + $scope.$apply(); | |
29 | + }) | |
30 | + ); | |
31 | + }); | |
31 | 32 | |
32 | - $scope.$on('moveMap', function(evt, data) { | |
33 | - $scope.map.panTo(new L.LatLng(data.latitud, data.longitud)); | |
34 | - }); | |
35 | - }], | |
36 | - scope: { | |
37 | - latitud: '=', | |
38 | - longitud: '=', | |
39 | - zoom: '=' | |
40 | - } | |
33 | + $scope.$on('moveMap', function (evt, data) { | |
34 | + $scope.map.panTo(new L.LatLng(data.latitud, data.longitud)); | |
35 | + }); | |
36 | + }], | |
37 | + scope: { | |
38 | + latitud: '=', | |
39 | + longitud: '=', | |
40 | + zoom: '=' | |
41 | + } | |
41 | 42 | }; |
42 | -}); | |
43 | + }); |
src/js/service.js
1 | 1 | angular.module('focaModalLocalizar') |
2 | - .service('focaModalLocalizarService', [ | |
3 | - '$http', | |
4 | - 'API_ENDPOINT', | |
5 | - function($http, API_ENDPOINT) { | |
6 | - return { | |
7 | - getLatLng: function(direccion) { | |
8 | - return $http.get('https://nominatim.openstreetmap.org/search', {params: direccion}); | |
9 | - } | |
10 | - }; | |
2 | + .service('focaModalLocalizarService', [ | |
3 | + '$http', | |
4 | + 'API_ENDPOINT', | |
5 | + function ($http, API_ENDPOINT) { | |
6 | + return { | |
7 | + getLatLng: function (direccion) { | |
8 | + return $http.get('https://nominatim.openstreetmap.org/search', { params: direccion }); | |
11 | 9 | } |
12 | - ]); | |
10 | + }; | |
11 | + } | |
12 | + ]); |