Professional Documents
Culture Documents
Angular Js Filters (v1.3.0) Cheat Sheet: by Via
Angular Js Filters (v1.3.0) Cheat Sheet: by Via
Angular Js Filters (v1.3.0) Cheat Sheet: by Via
0) Cheat Sheet
by Roman K. (Roman) via cheatography.com/19465/cs/2500/
{{ value | filter_name : arg1 : arg2 }} Date to format either as Date object, ss Second in minute, padded (00-
milliseconds (string or number) or various 59)
In Javascript
ISO 8601 datetime string formats. s Second in minute (0-59)
$filter('filter_name')(value, arg1, arg2)
format (?), string .sss Millisecond in second, padded
(000-999)
Formatting rules. If not specified,
currency
mediumDate is used. a AM/PM marker
amount, number
Z 4 digit (+sign) representation of
Formats date to a string based on the
Input to filter the timezone offset (-1200-
requested format.
+1200)
symbol (?), string
json ww ISO-8601 week of year (00-53)
Currency symbol or identifier to be displayed
w ISO-8601 week of year (0-53)
object, *
number medium equivalent to 'MMM d, y
Any JavaScript object (including arrays and
h:mm:ss a' for en_US locale
number, number | string primitive types) to filter.
short equivalent to 'M/d/yy h:mm a'
Number to format Allows you to convert a JavaScript object into for en_US locale
JSON string.
fractionSize (?), number | string fullDate equivalent to 'EEEE, MMMM d,
Selects a subset of items from array and Orders a specified array by the expression
returns it as a new array. predicate. It is ordered alphabetically for
strings and numerically for numbers.
filter: expression
orderBy: expression
Expression — the predicate to be used for
selecting items from array. A predicate to be used by the comparator to
determine the order of elements.
string
function
The string is evaluated as an expression
and the resulting value is used for substring Getter function. The result of this function
match against the contents of the array. All will be sorted using the <, =, > operator.
A pattern object can be used to filter specific 3 first characters of a property called name).
special property name $ can be used (as in interpreted as a property name to be used in
{$:"text"}) to accept a match against any comparisons (for example "special name" to
property of the object. That's equivalent to sort object by the value of their special
the simple substring match with a string as name property). An expression can be
described above. optionally prefixed with + or - to control
ascending or descending sort order (for
function(value, index)
example, +name or -name). If no property is
A predicate function can be used to write provided, (e.g. '+') then the array element
arbitrary filters. The function is called for itself is used to compare where sorting.
each element of array. The final result is an
Array
array of those elements that the predicate
returned true for. An array of function or string predicates. The
first predicate in the array is used for sorting,
but when two items are equivalent, the next
orderBy
predicate is used.
array, Array
f the predicate is missing or empty then it
The array to sort. defaults to '+'.