Tuesday, June 30, 2015

AngularJS filter

AngularJS filter, is a special type of filter which can be used to filter out the contents of an array/collection bound to an ng-repeat directive, this comes in handy when we need to implement dynamic search/filtering capability on an array/collection of elements

The following is the syntax for using AngularJS filter
ng-repeat="<array/collection> | filter:<filter text>"

The following is an example of using filter, filter out specific elements from an array of objects.

<html ng-app>
    <meta charset="utf-8" />
    <title>AngularJS - Basic</title>
    <script src="angular.min.js"></script>
          <div ng-init="Employees=[
                       <li ng-repeat="emp in Employees | filter:'To'">
                         {{ emp.id }} - {{ emp.Name }}<br/>


Search Flipkart Products:

No comments: