<div ng-app ng-controller="MyCtrl">
<ul>
<li ng-repeat="item in items">{{item.name}}</li>
</ul>
<button type="submit" ng-click="send()">
Send
</button>
</div>
当按钮不在 ng-repeat 中时,如何将我的项目 ID 传递给 ng-click 函数?
最佳答案
items
已经在 $scope
中了,因为您正在 ng-repeat
中使用它。所以你应该能够ng-click="send(items)"
关于javascript - 将数组传递给 ng-click,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36915271/