Gowtham Gowtham - 1 year ago 106
AngularJS Question

Angular js ng-repeat not working

I have done a sample app with angular js and added a

to loop my data but it's not looping it. I have shown my code below

<li style="background: white url('{{book.imgUrl}}') no-repeat" ng-repeat="book in books">
<li>Rating: {{book.rating}}</li>
<li>Binding: {{book.binding}}</li>
<li>Publisher: {{book.publisher}}</li>
<li>Released: {{book.releaseDate}}</li>
<button class="btn btn-info pull-right" ng-click="addToKart(book)">Add to Kart</button>

I have created a live demo of the problem here

Answer Source

In order to get value in view from controller , you have to bind that with $scope.

Your books variable isn't bind with scope

Convert this

var books=[

to this


or like this



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download