1

I cant pass a value to form the ng-repeat to the ng-click in my angular aplication.

This is my html

        <div ng-repeat="x in tt" >
           <div>
                <div ng-hide={{x.quien!=dameLocal.nombre}}>
                    <a href ng-click="edit(x.id)">
                       <i class='fa fa-pencil-square-o fa-2x ' ></i>
                    </a>
                </div>
          </div>
      </div>

But the edit(x.id) dont recive any value. inspecting the code, i get this:

<a href="" ng-click="edit(x.id)">

so, why i dont get the id value in the ng-click?

Thanks in advance

Edit: If i put for example a

data-id={{x.id}} it get the x.id value, so what gives?

edit2:

Here is my Js:

    $scope.edit=function(a){
    console.log(a);
    // $scope.comentEdit(a);
    // $scope.comentDel(a);
}

1 Answers1

0

This id will send to your function edit(). Put a breakPoint in dev tools in edit function and you will see this id in it.

$scope.edit = function(id) {
    console.log(id);
};

Your data tt should be like this in that case:

$scope.tt = [
    {
        id: "123",
        name: "item"
    }
];