目前是这样写的
<li ng-repeat="data in datas"><a ng-click="handle($index)"></a></li>
我想知道如何在控制器里直接写而不是html传参数过去?
淡淡烟草味2017-05-15 16:51:50
<button ng-click="onClick($event)">Button</button>
$scope.onClick = function(evt) {
var index = $(evt.target).index(); //jquery
}
高洛峰2017-05-15 16:51:50
Although I don’t understand what the questioner wants to ask, I usually write like this in this situation:
<li ng-repeat="data in datas"><a ng-click="handle(data,$index)"></a></li>