91-9990449935 0120-4256464 |
AngularJS FiltersIn AngularJS, filters are used to format data. Following is a list of filters used for transforming data.
How to add filters to expressionsYou can add filters to expressions by using the pipe character |, followed by a filter. In this example, the uppercase filter format strings to upper case: See this example: Test it NowLet's apply the lowercase filter into the same example: See this example: Test it NowHow to add filters to directivesFilters can be added to directives, like ng-repeat, by using the pipe character |, followed by a filter. Let's take an example: In this example, orderBy filter is used to sort an array. See this example: Test it NowThe filter FilterThe filter Filter can only be used on arrays because it selects a subset of an array. It returns an array containing only the matching items. Let's take an example: This example will return the names that contain the letter "o". See this example: Test it NowFilter an array based on user inputYou can use the value of the input field as an expression in a filter by setting the ng-model directive on an input field. See this example: Test it NowSort an array based on user inputYou can sort an array according to the table columns. See this example: Test it NowAngularJS Custom FiltersYou can create your own filters by register a new filter factory function with your module. See this example: Test it Now
Next TopicAngularJS Tables
|