How to conditionally apply Angular filters on ng-repeat of object attributes?

Viewed 1234

I have an object with 100+ attributes, such as "name", "price", "expiry date"...etc I am using ng-repeat to iterate through all the key-pair values of the object and displaying them on a table.

<table class="table">
    <tr ng-repeat="x in attr_array">
        <td><b>{{x.key}}</b></td>
        <td>{{x.value}}</td>
    </tr>
</table>

But I want to use the Angular date-filter on certain attributes, such as any date fields:

{{ x.value | date: 'MMM d, y'}}

And ideally other filters too. How can I go about doing this?

2 Answers
Related