I have three arrays in a controller:
$scope.allUsers
containing all users by:id
and:name
. E.g. smth like this.$scope.job.delegated_to
containing information related to job delegation. Looks like this.$scope.job.delegated_to = [ {id: 5, user_id:33, user_name:"Warren", hour_count:4}, {id: 5, user_id:18, user_name:"Kelley", hour_count:2}, {id: 5, user_id:10, user_name:"Olson", hour_count:40}, {id: 5, user_id:42, user_name:"Elma", hour_count:2}, {id: 5, user_id:45, user_name:"Haley", hour_count:4}, {id: 5, user_id:11, user_name:"Kathie", hour_count:3} ]
$scope.freeUsers
wich has to contain all the users, not delegated to the job.
I added a watch
$scope.$watch('job.delegated_to.length', function(){
$scope.freeUsers = filterUsers( $scope.allUsers, $scope.job.delegated_to );
});
but have not been able to construct a working filter.
$Filter
that can be used on anng-repeat
directive. @Almaron can you clarify? – alonisser Jun 6 '14 at 9:09