I have a function that creates an object:
$scope.checkPosRole = function(possition, posRole, posFunction) {
var rolePos = {pos: possition, posRole: posRole, posFunction: posFunction};
$scope.rolePossition.push(rolePos);
};
The issue I'm facing is that I only want one object with a specific value for pos
in the array. If an object with a duplicate pos
value is added to the array, I want to replace the existing object with the new one.
I've attempted using various functions like foreach
to scan through the array, but haven't been able to achieve the desired outcome. Any assistance would be greatly appreciated.