<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功能?
答案 0 :(得分:1)
items
已经在$scope
上了,因为您在ng-repeat
中使用了ng-click="send(items)"
。所以你应该能够jQuery(this).find("> p");
答案 1 :(得分:0)
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<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>
&#13;
$(this).find("> p");
&#13;