0
I’m doing a select for a REST service, using Angular. But the page that should have the table populated with the data coming from select, is empty.
On my page, I have an input (To enter the driver’s name) and a button, which triggers the function that goes to the service and makes the select, so I send the registration to another page. The data is coming back, because in the js function callback, I print an Alert on the screen, with the returned object, however, I can’t popular my table with the select data. Would anyone know why? Thank you very much!
My js function that links to the service and makes 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 that should show the return data from 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>