I have a filter list which have 50 items. I just want to show 5 items and hide the rest to make a "Show More" button.
<ul>
<li ng-repeat="a in filters.area">
<input type="checkbox" ng-change="filter()" ng-model="a.checked"> {{ a.name }}
</li>
</ul>
<span>SHOW MORE</span>
Use limitTo
filter in AngularJS
{{ limitTo_expression | limitTo : limit : begin}}
Something like this for your example:
<ul>
<li ng-repeat="a in filters.area | limitTo: 5">
<input type="checkbox" ng-change="filter()" ng-model="a.checked">
{{a.name}}
</li>
</ul>
<span>SHOW MORE</span>
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.