Corner JS ui-utils ui.scroll does not display results

I have a rails 4 application using AngularJS. I am trying to create a prototype using the ui.scroll directive from angular ui-utils modules. My rails API works fine when I use ng-repeat, but when I try to use ng-scroll my viewport never has any data. NOTE. I use jquery in other parts of the application, so I do not use jqlite.

View: (I skip all header materials, but know that css / jscript is enabled)

<html ng-app="Raffler">
<body>
<div ng-controller="ItemCtrl">
    <div ng-scroll-viewport style="height:240px;">
        <ul>
            <li ng-scroll="entry in datasource">
                {{entry.name}}              
            </li>           
        </ul>
    </div>
</div> </body> </html>

Controller: (I skip all inclusions of the application, but I know that dependencies are inserted into it)

angular.module("eli.Controllers").controller("ItemCtrl", 
    ["$scope", "Item", function ($scope, Item) {

    $scope.items = Item.query();

  $scope.datasource = {
    get: function(index, count, success) {

      // ensure we don't overrun the bounds of the data array
      var start = Math.max(0, index);
      var end = Math.min(index + count, $scope.items.length);

      var results = [];
      for (var i = start; i < end; i++) {
        results.push($scope.items[i]);          
      }

      success(results);      
    },

    revision: function() {
        return $scope.items;
    }
  };
}

]);
+4
source share
1 answer

, , , , get .

, get. , , - , get , .

+1

Source: https://habr.com/ru/post/1548572/


All Articles