Question - Explain the various types of filters in AngularJS.
Answer -
In order to format the value of expression so that it can be displayed to the user, AngularJS has filters. It is possible to add these filters to the controllers, directives, services, or templates. AngularJS also provides support for creating custom filters.
Organizing data in such a way that it is displayed only when certain criteria are fulfilled is made possible using filters. Filters are added to the expressions using the pipe ‘|’ character.
Some AngularJS filters are:
- currency: Formats a number to the currency format
- date: Formats a data to some specific format
- filter: Selects a subset of items from an array
- json: Formats an object to a JSON string
- limitTo: Limits an array or string into a specified number of characters or elements
- lowercase: Formats a string to lowercase
- number: Formats a number to a string
- orderBy: Orders an array by an expression