Thursday, December 11, 2014

Angular Js: Filters


We have come a long way of studying Angular JS. This time in this post we will be looking at how we can use the predefined filters of angular and do some magic with it.

Before we dive in further, we have to look closely on what filters actually means. Let’s consider a simple example to get a feel on what are we actually talking about. Let’s say we have textbox that gets the user’s input and we are displaying that text beneath that textbox using, of course, the angular js bindings. Now we want to display the text into uppercase regardless of what user enters.

Here is the simple code that do the display operation.

image

Next, to apply the uppercase filter, we do the following:

image

Now if we run and see the output it will be like:

image

There are various other built in filters in Angular some of them are:

1. currency
2. date
3. filter
4. JSON
5. limitTo
6. lowercase
7. uppercase
8. number
9. orderBy

Hope you’d have liked the introduction to filters and how to use them with angular JS. We will be looking more at filters in the upcoming posts.

Stay Tuned.

Share this post

0 comments

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© 2013 Neelesh Vishwakarma
Posts RSS Comments RSS
Back to top