Javatpoint Logo
Javatpoint Logo

The filter Filter

The AngularJS "filter" filter is used to select a subset of an array and returns it as a new array. The "filter" filter can only be used on array, and it returns an array containing only the matching items.

Syntax:

Parameter explanation:

array: It specifies the source array.

expression: It may be string, object or function. It is used to select items from the array for matching.

comparator: It is used to compare the expected value from the filter expression and actual value from the object in the array.

anyPropertyKey: It is a special property name that matches against any property. It is optional. By default, it is $.

Let's take an example to demonstrate "filter" filter.

See this example:

Test it Now

Note: This example returns an array containing the letter "a" because filter is used on letter "a".

Next TopicJSON Filter




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA