ng-repeat with mysql database data

0

I have 02 tables in the bank (prospect and opportunity) the two tables have the prospectId. How do I display in ng-repeat. I was trying to inner join in the php query and returns this error in the angle "Error: [ngRepeat: dupes]". Someone has some examples.

/* Lista oportunidade */ 
$scope.listaOportunidades = []; 
var carregaOportunidades = function () { 
 $http.get("models/readOportunidades.php")
     .then(function (response) { 
            $scope.listaOportunidades = response.data; 
      }); 
 }; 
carregaOportunidades();
<?php
require '../../vendor/autoload.php';

use App\controllers\DB\Conn;

$PDO = new Conn;

$query = $PDO->getConn()->prepare('SELECT * FROM tb_prospect INNER JOIN tb_oportunidade ON tb_prospect.prospectId=oportunidadeCliente');
$query->execute();

while ($row = $query->fetch()) {
    $return[]= $row;
}
echo json_encode($return);
    
asked by anonymous 29.07.2018 / 23:20

1 answer

0

More information is needed to understand what's going on in your code:

  • HTML code where you are using the policy;
  • List returned by your Query;

By error, there are duplicate items (in angular understanding) during ng-repeat: link

p>

In this way, I believe that using the example below will work:

<div ng-repeat="valor in listaOportunidades track by valor.VALOR_UNICO_DO_REGISTRO"></div>

I also suggest that you review the query.

    
01.08.2018 / 01:36