Skip to content Skip to sidebar Skip to footer

AngularJS With Ng-scroll And Ng-repeat

Using angular-ui with angular. Markup includes an ng-scroll element, which I have working with retrieved data from a service. I'd like to create rows of items so an ng-repeat insid

Solution 1:

I had to wrap each inner array in a dummy "row" hash. Angular doesn't like arrays of arrays, it expects arrays of objects. This markup works with the new json:

<div class="row" >
  <div class="col-md-12" >
    <div class="video_thumb" ng-scroll='video_list in VideoIndexScrollerSource' buffer-size='10' padding="2" >
      <div class="row" ng-repeat="video in video_list.row">
        <p>
          <a ng-href="/guides/{{video._id}}" target="_self">
            <img ng-src="{{video.thumb}}">
          </a>
        </p>
      </div>
    </div>
  </div>
</div>

Solution 2:

I've seen this when setting the Angular $resource method to get when you're receiving an array (or otherwise not setting isArray:true when receiving an array).

The method query expects an array (docs):

'query': {method:'GET', isArray:true},

get expects an object:

'get': {method:'GET'},


Post a Comment for "AngularJS With Ng-scroll And Ng-repeat"