First of all, for a better user experience, I would avoid pagination in favour of infinite scroll. Here is a simple Angular infinite scroll implementation
I presume you are aware of minification-proof technique .controller('name', ['$scope', function($scope){}]
, so won't go into that.
Next, I see many fields like $scope.players
, $scope.teams
, ..., mixed with $scope.filters
, which can lead to namespace conflicts as the app grows. Hence I would gather all data-related fields into one object like $scope.data
. Then you can simply pass the whole object from your service instead of assigning one-by-one.
The hard-coded declation $scope.predicate = 'team.name';
is mixed with others provided by the service. Perhaps it belongs to a Config service together with other hard-coded properties.
Also I presume you are aware of the difference between using $scope.field
vs $scope.field.subfield
in terms of their interactions with parent and child scopes.
EDIT.
Unless you know what you are doing, a recommended practice is to use $scope.field.subfield
. That way, in a child controller, you have both read and write access to it. If instead you use $scope.field
, then changing it from a child controller will add a variable on the local scope but won't change the parent scope as you likely intend, see here.
EDIT.
See also Misko's video on best practices, including putting the dot inside your $scope
property.
minMax($scope.players);
suggests that you are using service minMax
just for one function. I would gather those functions into one bigger service like Utils
. You already have lots of dependencies for your controller, so lowering that number can be a good thing. Similar for $scope.teams = TeamsModel;
.
I am not sure why you define filters inside a controller, rather than with .filter
as common.
Usually filters declared via .filter
update themselves, so no need for watchers.