browse other examples

# Datasource on scope (not as service)

Per documentation the datasource object can be defined in two different ways.

    <li ui-scroll="item in datasource">{{item}}</li>

And the directive will first look for a property with the given name (datasource) on its $scope. So to use scope-approach you need to declare datasource object on scope of your controller and define method get on it.

    angular.module('application', ['ui.scroll'])
      .controller('mainController', ...

        var get = function(index, count, success) { ... };

        $scope.datasource = { get: get };

      );

{{item}}