How to check uniquness while pushing values into array using Angular JS?

  $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??

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);
     }
}