Trying to retrieve the Id from a table and pass it to a controller, however, I am facing an issue where the Id value is lost every time the form changes. Is there a better way to handle this? Below is the service and controller code:
//Retrieving IdValue
app.controller('SeguimientoSolicitudesController', ['$scope', 'ParametrosSolicitudes', function ($scope, ParametrosSolicitudes) {
this.SegSolic = "";
var self = this;
$scope.ValorId = function (value) {
ParametrosSolicitudes.setVarIdSolicitud(value);
window.location.href = urlServer + "Home/About";
};
solicitudContext.obtenerListaSegSolicitudes(function (resp) {
switch (resp.ressult) {
case "tgp":
self.SegSolic = solicitudContext.ListaSeguimientoSolicitudes;
break;
case "notgp":
break;
default:
break;
}
$scope.$apply();
});
}]);
//Getting detail of the selected id but value is missing
app.controller('SolicitudesController', ['$scope', 'ParametrosSolicitudes', 'parameterConstant', function ($scope, ParametrosSolicitudes, parameterConstant) {
this.SolicitudDetalle = "";
var IdSolicitud = '';
var self = this;
$scope.$watch(function () { return ParametrosSolicitudes.getVarIdSolicitud() }, function () {
IdSolicitud = ParametrosService.getVarIdSolicitud();
});
solicitudContext.obtenerListaSolicitudes('R', IdSolicitud, function (resp) {
switch (resp.ressult) {
case "tgp":
self.SolicitudDetalle = solicitudContext.ListaSolicitudes;
break;
case "notgp":
break;
default:
break;
}
$scope.$apply();
});
}]);