Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 8ac369e

Browse files
committed
docs(ngModelController): update wordings, add more general info
The wordings in setDirty etc. were specific to inputs, but ngModelCtrl is agnostic to this and the preferred term is 'control'. I also added some more info about this to the description, and linked to the example that now lives at the bottom of the page.
1 parent 5c611e8 commit 8ac369e

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/ng/directive/input.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -1618,12 +1618,15 @@ is set to `true`. The parse error is stored in `ngModel.$error.parse`.
16181618
*
16191619
* @description
16201620
*
1621-
* `NgModelController` provides API for the `ng-model` directive. The controller contains
1622-
* services for data-binding, validation, CSS updates, and value formatting and parsing. It
1623-
* purposefully does not contain any logic which deals with DOM rendering or listening to
1624-
* DOM events. Such DOM related logic should be provided by other directives which make use of
1625-
* `NgModelController` for data-binding.
1626-
*
1621+
* `NgModelController` provides API for the {@link ngModel `ngModel`} directive.
1622+
* The controller contains services for data-binding, validation, CSS updates, and value formatting
1623+
* and parsing. It purposefully does not contain any logic which deals with DOM rendering or
1624+
* listening to DOM events.
1625+
* Such DOM related logic should be provided by other directives which make use of
1626+
* `NgModelController` for data-binding to control elements.
1627+
* Angular provides this DOM logic for most {@link input `input`} elements.
1628+
* At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example
1629+
* custom control example} that uses `ngModelController` to bind to `contenteditable` elements.
16271630
*
16281631
* @example
16291632
* ### Custom Control Example
@@ -1861,9 +1864,9 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
18611864
* @description
18621865
* Sets the control to its pristine state.
18631866
*
1864-
* This method can be called to remove the 'ng-dirty' class and set the control to its pristine
1865-
* state (ng-pristine class). A model is considered to be pristine when the model has not been changed
1866-
* from when first compiled within then form.
1867+
* This method can be called to remove the `ng-dirty` class and set the control to its pristine
1868+
* state (`ng-pristine` class). A model is considered to be pristine when the control
1869+
* has not been changed from when first compiled.
18671870
*/
18681871
this.$setPristine = function() {
18691872
ctrl.$dirty = false;
@@ -1898,8 +1901,8 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
18981901
* @description
18991902
* Sets the control to its untouched state.
19001903
*
1901-
* This method can be called to remove the 'ng-touched' class and set the control to its
1902-
* untouched state (ng-untouched class). Upon compilation, a model is set as untouched
1904+
* This method can be called to remove the `ng-touched` class and set the control to its
1905+
* untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched
19031906
* by default, however this function can be used to restore that state if the model has
19041907
* already been touched by the user.
19051908
*/
@@ -1916,10 +1919,9 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
19161919
* @description
19171920
* Sets the control to its touched state.
19181921
*
1919-
* This method can be called to remove the 'ng-untouched' class and set the control to its
1920-
* touched state (ng-touched class). A model is considered to be touched when the user has
1921-
* first interacted (focussed) on the model input element and then shifted focus away (blurred)
1922-
* from the input element.
1922+
* This method can be called to remove the `ng-untouched` class and set the control to its
1923+
* touched state (`ng-touched` class). A model is considered to be touched when the user has
1924+
* first focused the control element and then shifted focus away from the control (blur event).
19231925
*/
19241926
this.$setTouched = function() {
19251927
ctrl.$touched = true;

0 commit comments

Comments
 (0)