Yup, seems very straight forward! I just couldn't get the keywords right. Thanks Naveen .
On Sun, Jun 15, 2014 at 7:00 PM, Naveen Kohli <[email protected]> wrote: > Something like in your case will be.. > > > MyApp.filter('displayEpisodeCount', [function () { > return function (input) { (input == -1) ? "Unknown" : input; > }; > }]); > > > On Sunday, June 15, 2014 6:58:19 PM UTC-4, Naveen Kohli wrote: >> >> You can implement a custom filter. That filter will return the value >> formatted the way you want. >> >> {{item.episodes|displayEpisodeCount}} >> >> You can see example of a custom filter from following post. >> >> http://www.byteblocks.com/Post/Create-countdown-clock- >> using-angularJS-services >> >> The example is at the bottom of this post. >> >> On Sunday, June 15, 2014 6:50:28 PM UTC-4, Vaughan Hilts wrote: >>> >>> I have an HTTP rest call that fetches a number from an endpoint. It will >>> sometimes return '-1' to indicate that the number is 'unknown' (it's an >>> episode count). Right now, I just use string interpolation? >>> {{item.episodes}}?, but this displays a nasty '-1'. How can I get a clean >>> 'Unknown', the angular way? One obvious way is at fetch time iterate the >>> items, and assign all -1's to 'Unknown'. >>> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "AngularJS" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/angular/ZwzrUqH0z1E/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
