Sorting and paginating with AngularJS