0

When i use the ng-click inside ng-repeat ,the function param is not work when i click the button.but in the dom is works .

	$scope.Modify=function(a){
		console.log("Edit"+a);
	}
	$scope.Del=function(a,b){
		console.log("DEL:"+a);
		Metronic.ajax("delete","vt/"+a,{},true,Metronic.handleResponse,delValue,b);
	}
	
<tr ng-repeat="vr in data">
	<td>{{$index}}</td>
	<td>{{vr.type_name}}</td>
	<td>{{vr.sort}}</td>
	<td>
	<a href="javascript:;" class="btn btn-xs btn-success" ng-click="Modify('{{vr.vt_id}}')">Edit</a>
	<a href="javascript:;" class="btn btn-xs btn-danger" ng-click="Del($index)">Del</a>
	</td>
</tr>

enter image description here

enter image description here

1 Answer 1

1

You don't need the curly braces when you are passing a variable into a function. Change ng-click="Modify('{{vr.vt_id}}')"> to ng-click="Modify(vr.vt_id)">

Sign up to request clarification or add additional context in comments.

1 Comment

But the dom has not compile to the variable in this way. <a href="javascript:;" class="btn btn-xs btn-success" ng-click="Modify(vr.vt_id)">Edit</a>

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.