如何在angularJs中传递动态变量给limitTo过滤器
how to pass dynamic variable to limitTo filter in angularJs
<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>    <a
class="risposta" style="color: #0088cc;" ng-click="cmtText(coursCmt.cId,coursCmt)" >Rispondi</a>    <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>      
<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>
就像这样把胡子去掉
ng-repeat="replyCmt in coursCmt.replyCmts |orderBy : '-cWhen' | limitTo:coursCmt.cId"
相关文章:
- 将变量动态添加到每个控制器的作用域
- 如何合并代码|使变量动态
- 如何将选择复选框值动态传递给 ajax 调用变量动态发布到 php 变量
- 如何根据javascript变量动态更改Facebook评论插件URL
- 如何通过变量动态设置一个国家的颜色
- 如何使用 React.createElement 基于 prop 或变量动态创建组件
- Angularjs基于存储在会话存储中并存储在$scope上的变量动态显示/隐藏元素
- 如何在JavaScript中使用变量动态访问对象属性
- 在ASP.NET MVC3剃刀上使用javascript变量动态创建html操作链接
- 将变量动态添加到URL
- 通过cookie变量动态更改HTML元素
- 给对象赋值.变量动态形成
- 如何使用变量动态构建正则表达式对象
- AngularJS如何用变量动态更新部分作用域
- 将变量动态分配给jquery自动完成查询字符串
- 用户和来宾使用两个不同的模板?或者使用客户端变量动态更改视图
- 根据传递的变量动态添加子字段名
- PHP回显在Javascript变量动态更改饼图图
- 为未定义的变量动态赋值
- 使用相同的划分和变量动态创建谷歌地图