Reputation: 157
$scope.displayyears = [];
$scope.Joinyear = function(display) {
$scope.yeardisplay = display;
$scope.yeardisp = $scope.displayyears.push($scope.yeardisplay);
$scope.displayyearss = uniq($scope.yeardisp)
}
it throws error like "uniq is undefined"..How we check uniqueness??
Upvotes: 13
Views: 19961
Reputation: 9572
Try checking if the yeardisplay is already in the array before you add it
$scope.displayyears = [];
$scope.Joinyear=function(display){
$scope.yeardisplay=display;
if ($scope.displayyears.indexOf(display) == -1) {
$scope.displayyears.push(display);
}
}
Upvotes: 24