2016-09-28 50 views
0
<div class="container"> 
    <div class="row" ng-repeat="coursCmt in courArg.coursCmts" 
     ng-init="userInfo(coursCmt)"> 

     <div class="col-sm-1 col-xs-2"> 
      <div class="thumbnail"> 
       <img class="img-responsive user-photo" 
        ng-src="{{coursCmt.imagePath || 'defaultimage.png'}} "> 
      </div> 
      <!-- /thumbnail --> 
     </div> 
     <!-- /col-sm-1 --> 

     <div class="col-sm-11 col-xs-10" style="padding-left: 10px"> 
      <div> 
       <div> 
        <strong>{{coursCmt.username}}</strong> 
       </div> 
       <div>{{coursCmt.cText}}</div> 
       <!-- /panel-body --> 

       <small><a style="color: #0088cc" >Mi piace</a>&nbsp&nbsp&nbsp&nbsp<a 
        class="risposta" style="color: #0088cc;" ng-click="cmtText(coursCmt.cId,coursCmt)" >Rispondi</a>&nbsp&nbsp&nbsp&nbsp<span 
        class="text-muted"> {{coursCmt.cWhen | date:'MMM d, y h:mm:ss a '}}</span></small><br> 
       <strong><a id="quantity{{coursCmt.cId}}" style="color: #0088cc" ng-click="quantityfunct(coursCmt.cId)" ng-if ="coursCmt.replyCmts.length>1"><span class="glyphicon glyphicon-menu-down"></span>Vedere tutte le {{coursCmt.replyCmts.length}} risposte </a></strong> 
      </div> 
      <!-- /panel panel-default --> 

      <div class="row" ng-repeat="replyCmt in coursCmt.replyCmts |orderBy : '-cWhen' | limitTo:quantity{{coursCmt.cId}}" 
       ng-init="userReplyInfo(replyCmt)" style="padding-left: 40px"> 
       <div class="col-sm-1 col-xs-2"> 
        <div class="thumbnail" style="max-width: 70%; max-height: 70%"> 
         <img class="img-responsive user-photo" 
          ng-src="{{replyCmt.imagePath || 'defaultimage.png'}}"> 
        </div> 
        <!-- /thumbnail --> 
       </div> 
       <!-- /col-sm-1 --> 

       <div class="col-sm-11 col-xs-10" style="padding-left: 0px"> 
        <div> 
         <div> 
          <strong>{{replyCmt.username}}</strong> 
         </div> 
         <div>{{replyCmt.cText}}</div> 
         <!-- /panel-body --> 
         <small> <a style="color: #0088cc">Mi piace</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 
          <span class="text-muted">{{replyCmt.cWhen | date:'MMM d,y h:mm:ss a'}}</span></small> 
        </div> 

        <!-- /panel panel-default --> 
       </div> 

      </div> 
      <strong><a ng-hide="myValue{{coursCmt.cId}}" id="quantity1{{coursCmt.cId}}" style="color: #0088cc" ng-click="quantityback(coursCmt)">Ridure</a></strong> 
      <div id="message{{coursCmt.cId}}" style="display:none"> 


       <div class="col-sm-1 col-xs-2" > 
        <img 
         ng-src="{{profileImagePath || 'defaultimage.png'}} " style="max-width: 60%; max-height: 60%"> 
       </div> 
       <div class="col-sm-11 col-xs-10"> 
        <textarea ng-model="creplyText" class="form-control" rows="1" 
         style=" width: 95%" ng-enter="saveReplyCmt(creplyText,coursCmt.cId,coursCmt.coursArgsId,coursCmt.userId,user.id)"></textarea> 
       </div> 

      </div> 
     </div> 

     <!-- /col-sm-5 --> 
    </div> 


    <!-- /row --> 

</div> 
<script> 

     $scope.quantityfunct = function(coursCmt){ 
      $("#quantity"+coursCmt.cId).hide(); 
      $("#quantity1"+coursCmt.cId).show(); 
      $scope["myValue"+coursCmt.cId] = false; 
      $scope["quantity"+coursCmt.cId] =''; 
     } 

     $scope.quantityback = function(coursCmt){ 
      $("#quantity1"+coursCmt.cId).hide(); 
      $("#quantity"+coursCmt.cId).show(); 
      $scope["myValue"+coursCmt.cId] = true; 
      $scope["quantity"+coursCmt.cId] = 1; 
     } 
</script> 

回答

0

只需卸下鬍子這樣

ng-repeat="replyCmt in coursCmt.replyCmts |orderBy : '-cWhen' | limitTo:coursCmt.cId" 
+0

coursCmt.cId是coursCmt對象的ID .....我只需要改變的限制只是一個接一 –