Well, there's probably be a better way (and I was typing this as Sander answered), but the first thing that comes to mind is to inject $filter service into your controller and set person.BirthDate to the formatted value (or use another field altogether if you need to keep reference to the original):
function MyCtrl($scope, $filter){ var angularDateFilter = $filter('date'); angular.forEach($scope.contacts, function(contact){ contact.BirthDate2 = angularDateFilter( contact.BirthDate, 'medium' ) }) } <p>Filter by Name: <input type="text" ng-model="contactsfilter.Name"/></p> <p>Filter by BirthDate: <input type="text" ng-model="contactsfilter.BirthDate2"/></p> <ul> <li ng-repeat="item in contacts | filter: contactsfilter" > <div>{{person.FirstName}}</div> <div>{{person.BirthDate | date:"medium"}}</div> </li> </ul> On Wednesday, March 19, 2014 8:57:03 PM UTC-6, Moab wrote: > > Looked around and couldn't find an answer for this, possibly because I'm > not sure what this would be referred to - filtering on a filtered value? > > I've got a collection rendered in a simple list using ng-repeat similar to > the following: > > ------------------------------------------ > <script> > $scope.contacts = [ > {Name: "George", BirthDate: "01/15/1940"}, > {Name: "John", BirthDate: "02/15/1940"}, > {Name: "Ringo", BirthDate: "03/15/1940"}, > {Name: "Paul", BirthDate: "04/15/1940"} > ]; > </script> > > <p>Filter by Name: <input type="text" ng-model="contactsfilter.Name"/></p> > <p>Filter by BirthDate: <input type="text" > ng-model="contactsfilter.BirthDate"/></p> > > <ul> > <li ng-repeat="item in contacts | filter: contactsfilter" > > <div>{{person.FirstName}}</div> > <div>{{person.BirthDate | date:"medium"}}</div> > </li> > </ul> > ------------------------------------------ > > The textbox filter for Name works great, and so does the filter for > BirthDate if I enter "1" for instance. But if I enter "Jan" of course, the > resulting rendered list is empty because it's filtering the original column > value of "01/15/1940", not the filtered output of "Jan 15, 1940" that is > rendered in the column. > > So I'd like to be able to bind the textbox filter to the output of the the > filtered date column and have it include or exclude the array item. > > Any ideas - am I missing a simple way to configure this? > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.