AngularJS expressions can get fairly complex and contain function invocations. Those functions might serve different purposes but model transformations and formatting are common needs. To cater for those common use-cases AngularJS expressions support special formatting (transforming) functions called filters:
In this example the
date filter is used to format user's sign-up date.
A filter is nothing more than a global, named function that is invoked in view using the pipe (
|) symbol with parameters separated by the colon (
:) character. In fact we could re-write our sample code like so (provided that the
formatDate function is defined on a scope):