# Developer Guide: Templates: Filters: Creating Angular Filters

Writing your own filter is very easy: just define a JavaScript function on the `angular.module.ng.$filter` object. The framework passes in the input value as the first argument to your function. Any filter arguments are passed in as additional function arguments.

You can use these variables in the function:

- `this` — The current scope.
- `this.$element` — The DOM element containing the binding. The `$element` variable allows the filter to manipulate the DOM.

The following sample filter reverses a text string. In addition, it conditionally makes the text upper-case and assigns color.

## Demo Source Code

### Related Topics

- Understanding Angular Filters
- Angular HTML Compiler

### Related API

- `Angular Filter API`