问题
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> 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> 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> 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> 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