` element could be any element which supports text content, such as ``.
+ * If the ng-model value is `null`, it is treated as equivalent to the empty string for rendering
* purposes.
*/
@Decorator(selector: '[contenteditable][ng-model]')
diff --git a/lib/formatter/currency.dart b/lib/formatter/currency.dart
index b71c0fa10..d0b7e8bff 100644
--- a/lib/formatter/currency.dart
+++ b/lib/formatter/currency.dart
@@ -9,7 +9,7 @@ part of angular.formatter_internal;
*
* Usage:
*
- * {{ numeric_expression | currency[:symbol[:leading]] }}
+ * {{ numeric_expression | currency[:symbol[:leading=false]] }}
*
*/
@Formatter(name:'currency')
@@ -22,7 +22,8 @@ class Currency implements Function {
*
* - `value`: the value to format as currency.
* - `symbol`: the currency symbol to use. If no symbol is specified, `$` is used.
- * - `leading`: places the symbol in front of the number instead of following it.
+ * - `leading`: when set to false, places the symbol after the number instead of before
+ * it. (By default, leading is set to true.)
*/
call(value, [symbol = r'$', leading = true]) {
if (value is String) value = double.parse(value);
diff --git a/lib/formatter/date.dart b/lib/formatter/date.dart
index 372217f04..abdd4e766 100644
--- a/lib/formatter/date.dart
+++ b/lib/formatter/date.dart
@@ -23,7 +23,7 @@ part of angular.formatter_internal;
*
*
* For more on explicit formatting of dates and date syntax, see the documentation for the
- * [DartFormat class](http://api.dartlang.org/docs/releases/latest/intl/DateFormat.html).
+ * [DartFormat class](https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/intl/intl.DateFormat).
*
*/
@Formatter(name:'date')
diff --git a/lib/formatter/json.dart b/lib/formatter/json.dart
index 8bc45666d..cf0ab172b 100644
--- a/lib/formatter/json.dart
+++ b/lib/formatter/json.dart
@@ -1,8 +1,14 @@
part of angular.formatter_internal;
/**
- * Allows you to convert a JavaScript object into JSON string. This formatter is
- * mostly useful for debugging.
+ * Converts an object into a JSON string.
+ *
+ * This formatter is mostly useful for debugging.
+ *
+ * Note that the object to convert must be directly encodable to JSON, that is, a
+ * number, boolean, string, null, list or a map with string keys). To convert other objects, the
+ * [toEncodable](https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-convert
+ * .JsonCodec#id_encode) function must be used first.
*
* Usage:
*
diff --git a/lib/formatter/limit_to.dart b/lib/formatter/limit_to.dart
index a38467f61..b2071e1e3 100644
--- a/lib/formatter/limit_to.dart
+++ b/lib/formatter/limit_to.dart
@@ -2,20 +2,28 @@ part of angular.formatter_internal;
/**
* Creates a new List or String containing only a prefix/suffix of the
- * elements as specified by the `limit` parameter.
+ * elements.
+ *
+ * The number of elements to return is specified by the `limitTo` parameter.
+ *
+ * Usage:
+ *
+ * {{ expression | limitTo:_number_ }}
*
- * When operating on a List, the returned list is always a copy even when all
- * the elements are being returned.
*
- * When the `limit` expression evaluates to a positive integer, `limit` items
- * from the beginning of the List/String are returned. When `limit` evaluates
- * to a negative integer, `|limit|` items from the end of the List/String are
- * returned. If `|limit|` is larger than the size of the List/String, then the
- * entire List/String is returned. In the case of a List, a copy of the list is
- * returned.
+ *
{{item}}
*
- * If the `limit` expression evaluates to a null or non-integer, then an empty
- * list is returned. If the input is a null List/String, a null is returned.
+ *
+ * Where the input expression is a [List] or [String], and `limitTo` is:
+ *
+ * - **a positive integer**: return _number_ items from the beginning of the list or string
+ * expression.
+ * - **a negative integer**: return _number_ items from the end of the list or string expression.
+ * - **`|limitTo|` greater than the size of the expression**: return the entire expression.
+ * - **null** or all other cases: return an empty list or string.
+ *
+ * When operating on a [List], the returned list is always a copy even when all
+ * the elements are being returned.
*
* Example:
*
@@ -29,7 +37,7 @@ part of angular.formatter_internal;
*
* {{i}}
*
- * results in
+ * produces the following:
*
* i
* j
diff --git a/lib/formatter/lowercase.dart b/lib/formatter/lowercase.dart
index 004a837f5..c00b4ace4 100644
--- a/lib/formatter/lowercase.dart
+++ b/lib/formatter/lowercase.dart
@@ -1,7 +1,7 @@
part of angular.formatter_internal;
/**
- * Converts string to lowercase.
+ * Converts a string to lowercase.
*
* Usage:
*
diff --git a/lib/formatter/module.dart b/lib/formatter/module.dart
index 478c7844d..f668acc10 100644
--- a/lib/formatter/module.dart
+++ b/lib/formatter/module.dart
@@ -1,5 +1,4 @@
/**
- *
* Formatters for [angular.dart](#angular/angular), a web framework for Dart. A formatter is a
* pure function that performs a transformation on input data from an expression.
*
@@ -18,12 +17,11 @@
* or, in a repeater:
*
*
- *
- *
*/
library angular.formatter;
export "package:angular/formatter/module_internal.dart" show
+ FormatterModule,
Currency,
Date,
Filter,
diff --git a/lib/formatter/module_internal.dart b/lib/formatter/module_internal.dart
index 14a27d353..d13aa500e 100644
--- a/lib/formatter/module_internal.dart
+++ b/lib/formatter/module_internal.dart
@@ -19,6 +19,12 @@ part 'order_by.dart';
part 'uppercase.dart';
part 'stringify.dart';
+/**
+ * This module registers all the Angular formatters.
+ *
+ * When instantiating an Angular application through applicationFactory,
+ * FormatterModule is automatically included.
+ */
class FormatterModule extends Module {
FormatterModule() {
bind(Arrayify);
diff --git a/lib/formatter/number.dart b/lib/formatter/number.dart
index 1cb2514b6..831be37bf 100644
--- a/lib/formatter/number.dart
+++ b/lib/formatter/number.dart
@@ -3,7 +3,7 @@ part of angular.formatter_internal;
/**
* Formats a number as text.
*
- * If the input is not a number an empty string is returned.
+ * If the input is not a number, an empty string is returned.
*
*
* Usage:
@@ -17,12 +17,14 @@ class Number {
var _nfs = new Map
>();
/**
- * [value]: the value to format
+ * Format a number as text.
+ *
+ * - `value`: the value to format
+ * - `fractionSize`: Number of decimal places to round the number to.
+ *
+ * When `fractionSize` is not provided, fraction size is computed from the current locale's number
+ * formatting pattern. In the case of the default locale, it will be 3.
*
- * [fractionSize]: Number of decimal places to round the number to. If this
- * is not provided then the fraction size is computed from the current
- * locale's number formatting pattern. In the case of the default locale,
- * it will be 3.
*/
call(value, [fractionSize = null]) {
if (value is String) value = double.parse(value);
diff --git a/lib/formatter/order_by.dart b/lib/formatter/order_by.dart
index 739433d5d..fea03dc39 100644
--- a/lib/formatter/order_by.dart
+++ b/lib/formatter/order_by.dart
@@ -3,7 +3,32 @@ part of angular.formatter_internal;
typedef dynamic _Mapper(dynamic e);
/**
- * Orders the provided [Iterable] by the `expression` predicate.
+ * Orders the the elements of an object by a predicate expression.
+ *
+ * Usage:
+ *
+ *
+ *
+ *
+ * The input must be an [Iterable] object. The expression may be specified as:
+ *
+ * - `+`: sort the elements in asending order. This is the default comparator.
+ * - `-`: sort the elements in descending order.
+ * - **a string expression**: sort on a decorated/transformed value, such as "lastName",
+ * or to sort non-primitives values.
+ * - **a custom callable expression**: an expression that will be called to transform the element
+ * before a sort.
+ * - **a list**: the list may consist of either string or callable expressions. A list expression
+ * indicates a list of fallback expressions to use when a comparision results in the items
+ * being equal.
+ *
+ * If the expression is explicitly empty(`orderBy:''`), the elements are sorted in
+ * ascending order, using the default comparator, `+`.
+ *
+ * Last, by appending `:true`, you can set "descending order" to true,
+ * which has the same effect as the `-` comparator.
+ *
+ * # Examples
*
* Example 1: Simple array and single/empty expression.
*
@@ -24,7 +49,7 @@ typedef dynamic _Mapper(dynamic e);
*
*
* The empty string expression, `''`, here signifies sorting in ascending order
- * using the default comparator. Using `'+'` would also work as the `+` prefix
+ * using the default comparator. Using `'+'` would also work, as the `+` prefix
* is implied.
*
* To sort in descending order, you would use the `'-'` prefix.
@@ -44,7 +69,7 @@ typedef dynamic _Mapper(dynamic e);
*
* Example 2: Complex objects, single expression.
*
- * You may provide a more complex expression to sort non-primitives values or
+ * You may provide a more complex expression to sort non-primitive values or
* if you want to sort on a decorated/transformed value.
*
* e.g. Support you have a list `users` that looks like this:
@@ -135,7 +160,10 @@ class OrderBy implements Function {
}
/**
- * expression: String/Function or Array of String/Function.
+ * Order a list by expression.
+ *
+ * - `expression`: String/Function or Array of String/Function.
+ * - `descending`: When specified, use descending order. (The default is ascending order.)
*/
List call(List items, var expression, [bool descending=false]) {
if (items == null) {
diff --git a/lib/formatter/stringify.dart b/lib/formatter/stringify.dart
index 439bfc645..a1bc8ea3f 100644
--- a/lib/formatter/stringify.dart
+++ b/lib/formatter/stringify.dart
@@ -1,9 +1,9 @@
part of angular.formatter_internal;
/**
- * Allows you to convert an object to a string.
+ * Converts an object to a string.
*
- * Null object are converted to an empty string.
+ * Null objects are converted to an empty string.
*
*
* Usage:
diff --git a/lib/formatter/uppercase.dart b/lib/formatter/uppercase.dart
index 722170d2f..f47b56b01 100644
--- a/lib/formatter/uppercase.dart
+++ b/lib/formatter/uppercase.dart
@@ -1,7 +1,7 @@
part of angular.formatter_internal;
/**
- * Converts string to uppercase.
+ * Converts a string to uppercase.
*
* Usage:
*
diff --git a/test/angular_spec.dart b/test/angular_spec.dart
index f302eb20e..cbf545fb8 100644
--- a/test/angular_spec.dart
+++ b/test/angular_spec.dart
@@ -156,7 +156,7 @@ main() {
"angular.core.parser.Parser",
"angular.directive.AHref",
"angular.directive.ContentEditable",
- "angular.directive.DecoratorFormatter",
+ "angular.directive.DirectiveModule",
"angular.directive.InputCheckbox",
"angular.directive.InputDateLike",
"angular.directive.InputNumberLike",
@@ -210,6 +210,7 @@ main() {
"angular.directive.NgValidator",
"angular.directive.NgValue",
"angular.directive.OptionValue",
+ "angular.formatter_internal.FormatterModule",
"angular.formatter_internal.Currency",
"angular.formatter_internal.Date",
"angular.formatter_internal.Filter",