Improve this Doc View Source

## Overview

Filters are used for formatting data displayed to the user.

They can be used in view templates, controllers or services. AngularJS comes with a collection of built-in filters, but it is easy to define your own as well.

The general syntax in templates is as follows:

    {{ expression [| filter_name[:parameter_value] ... ] }}

## Usage

`$filter(name);`

### Arguments

Param | Type | Details
--- | --- | ---
name | String | Name of the filter function to retrieve

### Returns

Function | the filter function

## Example

    <div ng-controller="MainCtrl">
     <h3>{{ originalText }}</h3>
     <h3>{{ filteredText }}</h3>
    </div>

    angular.module('filterExample', [])
    .controller('MainCtrl', function($scope, $filter) {
      $scope.originalText = 'hello';
      $scope.filteredText = $filter('uppercase')($scope.originalText);
    });