/app/public/js/libs/angular/docs/partials/guide/dev_guide.templates.filters.using_filters.html

https://bitbucket.org/kaiquewdev/front-in-sampa-example · HTML · 47 lines · 35 code · 12 blank · 0 comment · 0 complexity · ed852e9ba5a17214eae1be8e82166d94 MD5 · raw file

  1. <h1><code ng:non-bindable=""></code>
  2. <span class="hint"></span>
  3. </h1>
  4. <div><p>Filters can be part of any <a href="api/ng.$rootScope.Scope"><code>api/ng.$rootScope.Scope</code></a> evaluation but are typically used to format
  5. expressions in bindings in your templates:</p>
  6. <pre><code> {{ expression | filter }}
  7. </code></pre>
  8. <p>Filters typically transform the data to a new data type, formatting the data in the process.
  9. Filters can also be chained, and can take optional arguments.</p>
  10. <p>You can chain filters using this syntax:</p>
  11. <pre><code> {{ expression | filter1 | filter2 }}
  12. </code></pre>
  13. <p>You can also pass colon-delimited arguments to filters, for example, to display the number 123 with
  14. 2 decimal points:</p>
  15. <pre><code> 123 | number:2
  16. </code></pre>
  17. <p>Here are some examples that show values before and after applying different filters to an
  18. expression in a binding:</p>
  19. <ul>
  20. <li>No filter: <code>{{1234.5678}}</code> => <code>1234.5678</code></li>
  21. <li>Number filter: <code>{{1234.5678|number}}</code> => <code>1,234.57</code>. Notice the "," and rounding to two
  22. significant digits.</li>
  23. <li>Filter with arguments: <code>{{1234.5678|number:5}}</code> => <code>1,234.56780</code>. Filters can take optional
  24. arguments, separated by colons in a binding. For example, the "number" filter takes a number
  25. argument that specifies how many digits to display to the right of the decimal point.</li>
  26. </ul>
  27. <h3>Related Topics</h3>
  28. <ul>
  29. <li><a href="guide/dev_guide.templates.filters">Understanding Angular Filters</a></li>
  30. <li><a href="guide/dev_guide.templates.filters.creating_filters">Creating Angular Filters</a></li>
  31. </ul>
  32. <h3>Related API</h3>
  33. <ul>
  34. <li><a href="api/ng.$filter"><code>Angular Filter API</code></a></li>
  35. </ul></div>