Last active
September 18, 2015 21:33
-
-
Save mauroa/c473488f1603784db71b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
controllers.controller('HomeController', function(filtrosService, httpService) { | |
var viewModel = this; | |
viewModel.nombre = 'Antes'; | |
viewModel.especialidades = filtrosService.getEspecialidades(); | |
viewModel.actualizarNombre = function(nombreNuevo){ | |
alert('estoy en actualizar nombre: ' + nombreNuevo); | |
viewModel.nombre = nombreNuevo; | |
} | |
viewModel.getRest = function() { | |
httpService.getUsuario('22755022', 'M', viewModel.actualizarNombre); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.factory('httpService', function($http) { | |
return { | |
getUsuario: function(dni, sexo, actualizar) { | |
alert('DNI: '+ dni + ' Sexo: '+ sexo); | |
$http.get('http://www.osdepym.com.ar:8080/OSDEPYM_CartillaWeb2/rest/mobile/getAfiliado?dni='+dni+'&sexo='+sexo+'') | |
.then(function(resp) { | |
//alert(JSON.stringify(resp)); | |
var nombre = resp.data.afiliadoTO.nombre; | |
//alert(nombre); | |
actualizar(nombre); | |
}, function(err) { | |
var nombre = 'Error'; | |
alert(JSON.stringify(err)); | |
}); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment