How to get selected value from ng-repeat

后端 未结 2 1259
有刺的猬
有刺的猬 2021-01-07 13:10

This is my code.

I m getting data through ng-repeat and showing it as shown in below code.

What I want is if I click on either of the name then it should ale

2条回答
  •  误落风尘
    2021-01-07 13:32

    You are going good so far. You added the ng-click event. But aal you need to do to get the name in controller is, you need to paas the current item as arguement See Here {{x.firstname}}

    and in the controller make a function

    $scope.selectInfo = function (item) {
       alert(item.firstname);
       // Or use this to do whatever you want
    }
    

提交回复
热议问题