probably a rocky question but nonetheless, i'd like to understand the reason for that.
I have an input field like so:
<div>
    <label class="col-xs-2" for="selectedJdeEsu">{{"JDE.jde_wizard.esu_name" | translate}}</label>
    <input ng-model="selectedEsu" type="text/>
    <div class = "btn wizard-next btn-primary" ng-click="addCurrent(selectedEsu)">
        <i class="fa fa-plus-circle" aria-hidden="true" ></i>
        add
    </div>
    <div ng-show="esuNameErr" style="color: red">
        {{esuNameErr}}
    </div>
</div>
and angularJS like so:
    $scope.addCurrent = function(curr){
        var found = false;
        for(var i = 0 ; i < $scope.jdeEsus.length ; i++){
            if($scope.jdeEsus[i].esuName === $scope.selectedEsu){
                $scope.selectedEsuList.push($scope.jdeEsus[i]);
                $scope.selectedEsu = '';
                $scope.esuNameErr = null;
                found = true;
                break;
            }
        }
        if(found == false && $scope.selectedEsu){
            $scope.esuNameErr = $filter('translate')('JDE.jde_wizard.esu_name_err')
        }
    };
$scope.jdeEsus is an array of objects.
now my problem is that while in the loop $scope.selectedEsu is undefined, while curr gets the right value, even though it comes from the same source.
I want to know why?
 
     
    