1
I have the following HTML
<div class="col-md-4">
<div class="exibeUnidades">
<table width="400">
<thead>
<tr>
<td width="100"><b>Profissionais</b></td>
</tr>
</thead>
<tbody>
<tr ng-repeat="pro in profissionais track by name">
<td width="100"><a href="#agendaProfissional/{{pro.idprofissional}}">{{pro.nome}}</a></td>
<td width="160">{{pro.funcao}}</td>
<td width="160">{{pro.unidade}}</td>
</tr>
</tbody>
</table>
</div>
</div>
'Cause I’m doing the following consultation at the bank:
<?php
$idestabel = $_GET['idestabel'];
$getPro=$pdo->prepare("SELECT * FROM unidade INNER JOIN profissional
ON profissional.idunidade = unidade.idunidade WHERE idestabelecimento=:idestabel");
$getPro=bindValue(":idestabel", $idestabel);
$getPro->execute();
while ($linhaPro=$getPro->fetch(PDO::FETCH_ASSOC)) {
$idunidade = $linhaPro['idunidade'];
$unidade = $linhaPro['unidade'];
$idprofissional = $linhaPro['idprofissional'];
$idunidade = $linhaPro['idunidade'];
$nome = $linhaPro['nome'];
$funcao = $linhaPro['funcao'];
$return[] = array(
'idprofissional' => $idprofissional,
'nome' => $nome,
'funcao' => $funcao,
'unidade' => $unidade
);
}
?>
My controller:
app.controller("ProfissionaisCtrl", ['$scope', '$http', '$window', '$location', '$rootScope', function ($scope, $http, $window, $location, $rootScope) {
$rootScope.idestabelecimento = localStorage.getItem('idestabelecimento');
var getPro = function(){
var idestabel = $rootScope.idestabelecimento;
var opcao = 3 // Buscar profissionais
$http.get("http://reservacomdomanda.com/areaAdmin/api/admin_estabelecimento/profissionais.php?opcao="+opcao+"&idestabel="+idestabel).success(function(response){
$scope.profissionais = response;
})
}
getPro();
}]);
And this is the message that appears on the console:
angular.js:12477 Error: [ngRepeat:dupes] Duplicates in a Repeater are not allowed. Use 'track by' Expression to specify Unique Keys. Repeater: pro in profissionais track by name, Duplicate key: Undefined, Duplicate value: b
Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).
– Sorack