filter in ng-repeat by values?

时间秒杀一切 提交于 2019-12-25 07:59:53

问题


I would like to filter an ng-repeat by a key that has 4 values(1-4) using uib-tabs. Is there a way to do this inline with ng-model on the tab elements? If so, what is the format? For instance, I have an ng-repeat like this:

<div ng-repeat="item in reportsData">{{item.name}} - {{item.packageID}}</div>

and in my reportsData array I have

..."packageID": 1,...

Where packageID can be of a value between 1 and 4. The trick is that I want to setup something along the lines of

item.packageID >=1

How do I do this? Here is an example:

<uib-tabset active="active">
 <uib-tab index="0" select="" ng-model="?">
    <uib-tab-heading><span class="pkg-sm-ss pull-left"></span>&nbsp;&nbsp;Package 1</uib-tab-heading>
 </uib-tab>
  <uib-tab index="1" select="" ng-model="?">
    <uib-tab-heading><span class="pkg-sm-s pull-left"></span>&nbsp;&nbsp;Package 2</uib-tab-heading>
 </uib-tab>
 <uib-tab index="2" select="" ng-model="?">
    <uib-tab-heading><span class="pkg-sm-b pull-left"></span>&nbsp;&nbsp;Package 3</uib-tab-heading>
</uib-tab>
<uib-tab index="3" select="" ng-model="?">
    <uib-tab-heading><span class="pkg-sm-i pull-left"></span>&nbsp;&nbsp;Package 4</uib-tab-heading>    
</uib-tab>

View Sample {{item.name}}

{{item.description | limitTo: 160}}

View Details = 4"> = 3"> = 2"> = 1">

I cant get the code to format correctly here but this is what Im trying to do.

来源:https://stackoverflow.com/questions/38385095/filter-in-ng-repeat-by-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!