Commit 63066925868da0f151a80f3fefe1ed6ba3e9858a

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

Merge branch 'master' into 'master'

Master

See merge request !2
src/js/controller.js
... ... @@ -5,8 +5,9 @@ angular.module('focaModalLocalizar')
5 5 '$uibModalInstance',
6 6 'focaModalLocalizarService',
7 7 'direccion',
  8 + 'focaModalService',
8 9 function($scope, $uibModalInstance,
9   - focaModalLocalizarService, direccion) {
  10 + focaModalLocalizarService, direccion, focaModalService) {
10 11  
11 12 $scope.latitud = -32.89214159952345;
12 13 $scope.longitud = -68.84572999101856;
... ... @@ -21,12 +22,16 @@ angular.module('focaModalLocalizar')
21 22 format: 'json'
22 23 })
23 24 .then(function(res) {
24   - $scope.latitud = res.data[0].lat;
25   - $scope.longitud = res.data[0].lon;
26   - $scope.$broadcast('moveMap', {
27   - latitud: $scope.latitud,
28   - longitud: $scope.longitud
29   - });
  25 + if(res.data.length) {
  26 + $scope.latitud = res.data[0].lat;
  27 + $scope.longitud = res.data[0].lon;
  28 + $scope.$broadcast('moveMap', {
  29 + latitud: $scope.latitud,
  30 + longitud: $scope.longitud
  31 + });
  32 + }else {
  33 + focaModalService.alert('No se pudo localizar el domicilio');
  34 + }
30 35 });
31 36 }
32 37