I'm doing a select for a REST service, using Angular. But the page that should have the populated table with the data coming from select, goes blank.
In my page, I have an input and a button, which triggers the function that goes to the service and makes the select, so I'll send the record to another page. The data is returning, because in the callback of the js function, I start an alert on the screen, with the object returned, however, I can not popular my table with the select data. Would anyone know why? Thank you so much!
My js function that links to the service and does the select:
$scope.procurar = function (){
var nome = $scope.filtro;
$http.post(linkservice + "selectByNome", nome).then(function (response) {
$scope.nomes = response.data;
alert($scope.nomes.texto_cnh);
window.location.href = "resultadoBusca.jsp";
});
}
My table should show the return data of the select:
<table>
<tr>
<th>Nome</th>
<th>C.P.F</th>
<th>CNH</th>
<th>Categoria</th>
<th>Vencimento</th>
</tr>
<tr ng-repeat="x in nomes">
<td><a ng-click = "enviarDadosDetalhe(x)">{{x.id}}</a></td>
<td><a ng-click = "enviarDadosDetalhe(x)">{{x.cpf}}</a></td>
<td><a ng-click = "enviarDadosDetalhe(x)">{{x.texto_cnh}}</a></td>
<td><a ng-click = "enviarDadosDetalhe(x)">{{x.data_validade_cnh}}</a></td>
<td>
<div ng-if ="x.status == 'a'">
<button ng-click = "alterarstatus(x)"> Inativar Motorista</button>
<button ng-click = "enviarDados(x)"> Atualizar motorista </button>
</div>
<div ng-if ="x.status == 'i'">
<button ng-click = "alterarstatus(x)"> Ativar Motorista</button>
<button ng-click = "enviarDados(x)"> Atualizar motorista </button>
</div>
</td>
</tr>