@@ -813,12 +813,21 @@ var VALID_CLASS = 'ng-valid',
813
813
*
814
814
* @property {string } $viewValue Actual string value in the view.
815
815
* @property {* } $modelValue The value in the model, that the control is bound to.
816
- * @property {Array.<Function> } $parsers Whenever the control reads value from the DOM, it executes
817
- * all of these functions to sanitize / convert the value as well as validate.
818
- *
819
- * @property {Array.<Function> } $formatters Whenever the model value changes, it executes all of
820
- * these functions to convert the value as well as validate.
816
+ * @property {Array.<Function> } $parsers Array of functions to execute, as a pipeline, whenever
817
+ the control reads value from the DOM. Each function is called, in turn, passing the value
818
+ through to the next. Used to sanitize / convert the value as well as validation.
821
819
*
820
+ * @property {Array.<Function> } $formatters Array of functions to execute, as a pipeline, whenever
821
+ the model value changes. Each function is called, in turn, passing the value through to the
822
+ next. Used to format / convert values for display in the control and validation.
823
+ * <pre>
824
+ * function formatter(value) {
825
+ * if (value) {
826
+ * return value.toUpperCase();
827
+ * }
828
+ * }
829
+ * ngModel.$formatters.push(formatter);
830
+ * </pre>
822
831
* @property {Object } $error An object hash with all errors as keys.
823
832
*
824
833
* @property {boolean } $pristine True if user has not interacted with the control yet.
0 commit comments