Peter Hoang
Peter Hoang

Reputation: 53

Angular Filters - filtering specific objects in an ng-repeat

I have an ng-repeat that outputs different types of objects in an an array (text, date, datetime, currency).

Without using ng-repeat, I can add the filter directly to the specific object:

{{lastModifiedDate | date:'MM-dd-yyyy HH:mm'}}

But if I use an ng-repeat, how do I apply filters to specific objects in the array?


EDIT:

Sorry - adding more information.

JSON:

[
    {
        "information": {
            "createdBy": "John Smith",
            "owner": "Jane Smith",
            "lastModifiedBy": "2017-04-13T17:14:17.000Z",
            "Future_Review_Date_Time__c": "2017-04-10T17:33:00.000Z",
            "CreatedDate": "2017-03-02T02:47:02.000Z",
            "Source": "Phone",
            "cost": "453"
        }
    }
]

If I did an ng-repeat over the json and want to add filters specifically for lastModifiedBy (Date), Future_Review_Date_Time__c (Date Time), CreatedDate (Date), and cost (Currency) - how do I add them?

Results:

Upvotes: 0

Views: 41

Answers (1)

Aravind
Aravind

Reputation: 41571

You should be using as below

<div ng-repeat="item in someArray" >
    {{item.lastModifiedDate | date:'MM-dd-yyyy HH:mm'}}

</div>

Upvotes: 1

Related Questions