Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

This blog is part of 1 Tute Sets.

AngularJs tutorials
  • Tutorial 3 - AngularJS Filter

    • 1
    • 1
    • 0
    • 7
    • 0
    • 0
    • 0
    • 0
    • 599
    Comment on it

    Hi all,

    In angularJs filters are use to change and modify the data. We can use multi filter using pipe (|).

    Below is some example of filters-

    1) uppercase
    2) lowercase
    3) currency
    4) filter
    5) orderby

    Uppercase :-

    Uppercase filter is use to make all letters capital.

    <input type="text" ng-model="student.lastName">
    Name : {{student.fullName() | uppercase}}
    

    Lowercase :-

    Lowercase filter is use to make all letters small.

    <input type="text" ng-model="student.lastName">
    Name : {{student.fullName() | lowercase}}
    

    Currency:-

    This filter is use to format currency.

    <input type="text" ng-model="student.lastName">
    Amount : {{student.fullName() | lowercase}}
    

    Filter :-

    It is use to filter any particular thing, for example-

      <input type="text" ng-model="subjectName">
    
      <ul>
        <li ng-repeat="subject in student.subjects | filter: subjectName">
          {{ subject.name + ', marks:' + subject.marks }}
        </li>
      </ul>
    

    In this example we have two thing one is subject name and second is subject mark, but list will filter with subject name recourse we are filter only subject name.

    Orderby:-

    This filter also plays an important role in filtering. We can sort a data list with it.

    Eg-

    <ul>
      <li ng-repeat="subject in student.subjects | orderBy:'marks'">
        {{ subject.name + ', marks:' + subject.marks }}
      </li>
    </ul>
    

    Hence, we have filter list order by marks

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: