简体   繁体   中英

ng-repeat inside ng-repeat not working in angularjs app

I am using two ng repeats but the second one it doesnt display. Let me show you my view :

<div  class="post" ng-repeat="user in users | orderBy:'username':false" ng-class-odd="'odd'" ng-class-even="'even'">
  <p>{{user.username}}</p> 
  <small><a ng-click='gotomessages(user.username)' class="btn btn-default">go</a></small>     
  <small class="pull-right"> Message</small>
  <div ng-repeat="message in messages[$index]">
    <p>{{message.name}}</p>   
  </div>
</div>

the $index is the one of the first ng-repeat. Is it possible to use it like i did ? In anyway the second ng repeat doesnt work can you help

只需在第二个ng-repeat使用$parent.messages[$index]而不是messages[$index]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM