I have object created by function:
$scope.checkPosRole = function(possition , posRole , posFunction) {
   var rolePos = {pos: possition, posRole: posRole, posFunction: posFunction}; 
   $scope.rolePossition.push(rolePos);
   };
The problem is that I want to in the array was only 1 object with the specified value of pos. In the case when the object is added with value pos that exists already in the array I want to swap new object with object exist already in array. 
I've tried every function call scan the tables with foreach, but did not bring me desirable effect. Please help.
 
     
    