Use format filters (like "date" or "uppercase" inside the ng-options

3,655 views
Skip to first unread message

edinardo...@gmail.com

unread,
Dec 12, 2012, 6:23:32 PM12/12/12
to ang...@googlegroups.com
<select ng-model="release" ng-options="r.date for r in releases | date"></select> doesn't work for ["2013-01-01T24:00Z","2013-02-01T24:00Z"] (just show the original value).

But if I use something like <select ng-model="release" ng-options="r.date for r in releases | orderBy:'date'"></select> or even <select ng-model="release" ng-options="r.date for r in releases | filter:myFilter"></select>, the ng-options soft the data or show just the filtered data. 

Seems that the problem is just related to format filters. Any other idea how I can format the data inside the ng-options?

Peter Bacon Darwin

unread,
Dec 13, 2012, 3:26:50 AM12/13/12
to ang...@googlegroups.com
Put the filter in the right place.  Where it is currently you are applying the date filter to an array of objects.
Instead I guess you want it to convert the label.


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
 
 

edinardo...@gmail.com

unread,
Dec 13, 2012, 12:40:36 PM12/13/12
to ang...@googlegroups.com
Yup, I was applying in the wrong place. Now is working perfectly. Thanks Peter!
Reply all
Reply to author
Forward
0 new messages