扫码关注官方订阅号
angular
价格:{{x.money}} 价值:{{x.price}} 评价: {{x.ecx}} {{x.good}} {{x.bad}}
走同样的路,发现不同的人生
app.filter('slice', function() { return function(input, start, end) { if(input) { return input.slice(+start, end ? +end : input.length); } return []; } });
ng-repeat="x in yesterday | slice: 5 : 7"
两种方式:
给 ng-repeat 加上 ng-if。用 $index 来控制输出
ng-repeat
ng-if
$index
在 controller 中先截取你需要显示的内容,然后 ng-repeat 直接遍历截取后的数组
个人不推荐用 filter,虽然能实现。你可以把 filter 加进去,然后在 filter 的 function 里面加上 console.log(),就知道它要运行多少次了
filter
function
console.log()
推荐第二种做法,很典型的数据驱动思路
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
两种方式:
给
ng-repeat加上ng-if。用$index来控制输出在 controller 中先截取你需要显示的内容,然后
ng-repeat直接遍历截取后的数组个人不推荐用
filter,虽然能实现。你可以把filter加进去,然后在filter的function里面加上console.log(),就知道它要运行多少次了推荐第二种做法,很典型的数据驱动思路