pagination and $rootScope