Estou com problema ao listar os dados do banco de dados, já tentei colocar track by $index
mas a quantidade de linhas que aparecem é diferente da quantidade existente no banco de dados, não sei oq fazer, estou tentando aprender angular com MySQL mas ta complicado…
<table class="table table-striped">
<tr>
<th>Title</th>
<th>Description</th>
<th>Added</th>
<th>Remove</th>
</tr>
<tr ng-repeat="blog in blogs">
<td>{{blog.id}}</td>
<td>{{blog.title}}</td>
<td>{{blog.description}}</td>
<td>{{blog.added_date}}</td>
<td><button class="btn btn-danger" ng-click="removeData(blog.id)">x</button></td>
</tr>
</table>
Erro:
angular.min.js:108 Error: [ngRepeat:dupes] http://errors.angularjs.org/1.4.1/ngRepeat/dupes?p0=blog%20in%20blogs&p1=string%3A%3C&p2=%3C
at Error (native)
at http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:6:416
at http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:278:39
at Object.fn (http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:131:92)
at m.$digest (http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:132:172)
at m.$apply (http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:135:161)
at l (http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:87:152)
at N (http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:91:187)
at XMLHttpRequest.x.onload (http://localhost/DatabaseWithAngular-master/lib/angularjs/angular.min.js:92:220)(anonymous function) @ angular.min.js:108(anonymous function) @ angular.min.js:80$digest @ angular.min.js:132$apply @ angular.min.js:135l @ angular.min.js:87N @ angular.min.js:91x.onload @ angular.min.js:92
angular.module(‘controller’, [])
.controller(‘BlogCtrl’, [’$scope’, ‘$http’, ‘$log’, function ($scope, $http, $log) {
$http.get('./js/popData.php') .success(function (data) { $scope.blogs = data; }) .error(function (err) { $log.error(err); })
}])
Projeto completo github