Commit 5868f79d1eaf90be3ae5eeb5dbbd67d01a698326

Authored by Pablo Marco del Pont
1 parent 99d02b55e2
Exists in master

Modifiqué formato de fecha.

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
src/js/osm-directive.js
1 angular.module('focaAdminSeguimiento').directive('osm', function() { 1 angular.module('focaAdminSeguimiento').directive('osm', function() {
2 return { 2 return {
3 restrict: 'E', 3 restrict: 'E',
4 link: function(scope, el, attrs) { 4 link: function(scope, el, attrs) {
5 var contenedor = document.createElement('div'); 5 var contenedor = document.createElement('div');
6 el.append(contenedor); 6 el.append(contenedor);
7 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom); 7 scope.map = L.map(contenedor).setView([attrs.latitud, attrs.longitud], attrs.zoom);
8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map); 8 L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(scope.map);
9 }, 9 },
10 controller: ['$scope', function($scope) { 10 controller: ['$scope', '$filter', function($scope, $filter) {
11 $scope.$watch('marcadores', function(valorNuevo) { 11 $scope.$watch('marcadores', function(valorNuevo) {
12 marcadores = $scope.marcadores; 12 marcadores = $scope.marcadores;
13 mapa = $scope.map; 13 mapa = $scope.map;
14 angular.forEach($scope.marcadores, function(marcador) { 14 angular.forEach($scope.marcadores, function(marcador) {
15 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map) 15 L.marker([marcador.latitud, marcador.longitud]).addTo($scope.map)
16 .bindPopup( 16 .bindPopup(
17 "Actividad: " + marcador.actividad + '<br/>' + 17 "Actividad: " + marcador.actividad + '<br/>' +
18 'Fecha: ' + marcador.fecha 18 'Fecha: ' + $filter('date')(marcador.fecha.slice(0,10), 'dd/MM/yyyy') +
19 ' ' + marcador.fecha.slice(11,19)
19 ).openPopup(); 20 ).openPopup();
20 }); 21 });
21 }); 22 });
22 }], 23 }],
23 scope: { 24 scope: {
24 latitud: '=', 25 latitud: '=',
25 longitud: '=', 26 longitud: '=',
26 zoom: '=', 27 zoom: '=',
27 marcadores: '=' 28 marcadores: '='
28 } 29 }
29 }; 30 };
30 }); 31 });
31 32