![](/img/trans.png)
[英]How would I pass data from on screen to another in React Native?
[英]How would I pass a id from one ngRepeat to another?
我正在做的是發布ngRepeat,還有其他評論。 我無法獲得這些帖子的評論,除非我知道如何將帖子的ID傳遞到評論ngRepeat中。
<div ng-app="posts" ng-controller="PostCtrl">
<div id="posts_container" ng-repeat="post in posts">
<div id="the_post">
<!-- I've got to pass the post.id to get the right comments for that post -->
<div id="the_comments" ng-repeat="comment in comments">
</div>
</div>
</div>
</div>
這在php foreach循環中很簡單,但是我沒有在angularjs中弄清楚。 嵌套ng-repeat也很好嗎? 謝謝你的幫助。
您正在尋找的過濾器嗎?
<div id="the_comments" ng-repeat="comment in comments | filter:{id:post.id}">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.