So, the following works when I run it on a local server:
html
<div class="container" ng-controller="TheController">
<ul id="grid" class="grid">
<li ng-repeat="guy in info">
<a href="#">
<img ng-src="{{ guy.img }}" alt="{{ guy.name }}">
<p class="guy-name">{{ guy.name }}</p>
</a>
</li>
</ul>
</div>
js -- and I'm doing something like this in my controller:
$http({ method: 'GET', url: 'data.json'}).success(function(data) {
$scope.info = data;
});
data
[
{
"img":"someImg.jpg",
"name":"Paul Saul",
"title":"Boss"
},
{
"img":"anotherImg.jpg",
"name":"Karalyn",
"title":"Web"
},
{
"img":"img.jpg",
"name":"Derp",
"title":"Retail"
}
]
But when I run it in production I get a ngRepeat:dupes error. Any ideas why? I've tried to add track by $index
as suggested in the docs and the error goes away but doesn't render the data and infinitely creates blank DOM nodes. Already read through the similar questions on SO, but can't seem to figure this out. I repeat, the above works locally with no errors; live it throws the error.