Translation :

I have HTML code with ng-click :

 <div ng-repeat="friend in friends"> <div ng-click="friend.blocked = true"></div> </div> 

How do I replace it with:

 ng-click="get()" 

and perform this operation in the get () function:

 $scope.get = function (){ friend.blocked = true } 

Original (Original):

I have HTML code with ng-click :

 <div ng-repeat="friend in friends"> <div ng-click="friend.blocked = true"></div> </div> 

How to replace this entry on:

 ng-click="get()" 

get ():

 $scope.get = function (){ friend.blocked = true } 
  • for language questions language use stackoverflow.com please. this site for questions on russian language only. - Alex

1 answer 1

You need to pass this object to the desired function as a parameter.

HTML:

 ng-click="get(friend)" 

Js:

 $scope.get = function (friend){ friend.blocked = true; }