Commit b222c0b34feef0d715da8c375319e2ab8e01578e

Authored by Eric Fernandez
1 parent 18d1a649b1
Exists in master and in 1 other branch develop

obtener posicion devolver en callback

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
1 angular.module('focaSeguimiento') 1 angular.module('focaSeguimiento')
2 .service('focaSeguimientoService', [ 2 .service('focaSeguimientoService', [
3 '$http', 'API_ENDPOINT', 'cordovaGeolocationService', 3 '$http', 'API_ENDPOINT', 'cordovaGeolocationService',
4 function($http, API_ENDPOINT, cordovaGeolocationService) { 4 function($http, API_ENDPOINT, cordovaGeolocationService) {
5 return { 5 return {
6 guardarPosicion: function(actividad, idComprobante, observaciones) { 6 guardarPosicion: function(actividad, idComprobante, observaciones) {
7 cordovaGeolocationService.getCurrentPosition(function(posicion) { 7 cordovaGeolocationService.getCurrentPosition(function(posicion) {
8 var nuevaPosicion = { 8 var nuevaPosicion = {
9 posicion: { 9 posicion: {
10 latitud: posicion.coords.latitude, 10 latitud: posicion.coords.latitude,
11 longitud: posicion.coords.longitude, 11 longitud: posicion.coords.longitude,
12 idComprobante: idComprobante, 12 idComprobante: idComprobante,
13 actividad: actividad, 13 actividad: actividad,
14 observaciones: observaciones 14 observaciones: observaciones
15 } 15 }
16 }; 16 };
17 17
18 console.info(nuevaPosicion); 18 console.info(nuevaPosicion);
19 return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion); 19 return $http.post(API_ENDPOINT.URL + '/seguimiento', nuevaPosicion);
20 }); 20 });
21 },
22 obtenerPosicion: function(callback) {
23 cordovaGeolocationService.getCurrentPosition(callback);
21 } 24 }
22 }; 25 };
23 } 26 }
24 ]); 27 ]);
25 28