I made a loop in angularjs and i want to get a distinct values from this loop then push it to an array.
What I got instead, are repetitive values.
The $scope.Empassignedvacations returns multiple data from datatable from db. one column from it is vac which displays multiple vacations keys in the db.
What i want to do is to take these keys and distinct them and push them to another $scope array. its name is $scope.checkedvacs. but i got 2,2,2,2,20,20,20,20
Assignments.getvacations().then(function (response) {
$scope.vacations = (response.data);
Assignments.GetEmpassignedvacations($scope.SelectedEmp1.staffkey)
.then(function (response) {
$scope.Empassignedvacations = (response.data)
$scope.checkedvacs.push( $scope.Empassignedvacations.vac );
angular.forEach($scope.Empassignedvacations, function (e) {
angular.forEach($scope.AlternateDirector, function (a) {
if (e.Staff_Key == a.Staff_Key) {
$scope.AlternateD = e.AlternateD;
}
})
angular.forEach($scope.status, function (s) {
if (e.status == s.stsid) {
$scope.sts = s.stsid;
}
})
})
Thanks in advance