sort

Sort an array by value or object property.

View Markdown

Syntax

{{ value | sort }}{{ value | sort:"desc" }}{{ value | sort:"name" }}{{ value | sort:("name", "desc") }}

Usage

  • Arrays sort in ascending order by default. Pass desc to reverse the direction.
  • Pass a property name to sort objects by that property. A dotted path selects a nested property.
  • With both a property and direction, wrap the parameters in parentheses.
  • Numbers are compared numerically. Missing and null property values remain at the end.
  • Serialized arrays and objects produced by another filter are recognized automatically.

Examples