mai*_*aik 3 angularjs ng-repeat
我想在表格中最多显示4行ng-repeat.如果有超过4行,我希望在第5行显示一个加号,单击该行时,将显示数据集中的其余行.我不确定从哪里开始.
table.table.table-striped.table-bordered
thead
tr
th.spacer.col-md-8
| Products: {{co.products.length}} Total - Click to preview
th.col-md-2
span.qty-ordered Qty Ordered
th.col-md-2
span.co-price Price
tbody
tr ng-repeat="prod in co.products"
td.co-product-name.col-md-6
a () {{prod.name}}
td.col-md-3
span () XX
td.col-md-3
span () {{prod.prices[0].price | currency}}
Run Code Online (Sandbox Code Playgroud)
使用限制过滤器:
tr ng-repeat="prod in co.products | limitTo : limit"
td.co-product-name.col-md-6
a () {{prod.name}}
td.col-md-3
span () XX
td.col-md-3
span () {{prod.prices[0].price | currency}}
tr ng-show='limit' ng-click='limit = undefined'
# controller
$scope.limit = 4;
Run Code Online (Sandbox Code Playgroud)