angular.module('app', ['ui.bootstrap', 'ngAnimate']) .factory('sortable', ['$filter', '$rootScope', function($filter, $rootScope){ return function (scope, data, itemsPerPage, initSortingOrder) { // functions have been described process the data for display scope.search(); } }]) .controller('main', [ '$scope', '$rootScope', 'sortable', function($scope, $rootScope, sortable) { }]);