ng-repeat in JSON file

Asked

Viewed 125 times

1

I’m putting together a menu with ng-repeat="espaco in espacos". Until then quiet.

<ul class="nav nav-pills nav-stacked">
    <li role="presentation" ng-repeat="espaco in espacos"><a href="" ng-click="selected(espaco)">{{espaco.nome}}</a></li>
</ul>

In the controller I am retrieving the "space" clicked and returning the information about it from a JSON, where some "spaces" have more than one image to display.

In the div that displays the images I am using ng-repeat="img in i" but the images are not being updated when I click on another menu item(other space), the following error appears:

Error: [ngRepeat:dupes]
  • I solved. Actually the JSON picture indexeUrl is an array so regardless of whether a space has 01 or 1000 images it must be represented as an array, ie "imagemUrl": [ 'camioDaImagem.png' ] with the brackets. Summarizing the problem was only the absence of brackets in JSON.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.