Here is the HTML code I have:
<div ng-click="changeBorder(value)" ng-class="{active_borders:isActive(value)}" ng-repeat="value in values">
<img class="card-img-bottom" src="{{value.Imagen}}" />
</div>
This is my Javascript code:
$scope.isActive = function isActive(value){return $scope.valueSelected.Id==value.Id;}
$scope.changeValue=function changeValue(value){$scope.valueSelected=value;}
EXPLANATION: I am trying to achieve a functionality where clicking on a div, containing an image, will change the border color of that specific div. Only the last clicked div should have its border colored.
MY PROBLEM: The issue I am facing is that the isActive() function is being executed twice instead of once during the ng-repeat cycle as intended.
I want to avoid this double execution because the function involves database communication, and it could cause complications if it runs constantly.