browse other examples

# Datasource as service

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

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

In this sample we use service-approach. Here you need to define angular service and declare method get on it.

    angular.module('application', ['ui.scroll'])
      .factory('datasource', function() { ...

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

        return { get: get };
      });

{{item}}