diff options
| author | Igor Minar | 2012-06-11 23:49:24 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-06-12 00:10:18 -0700 |
| commit | f16150d5f1b20b3d633b4402095ea89baa4be042 (patch) | |
| tree | 9d5c570348264884174ecca52b958da7a821fcf8 /docs/content/guide/forms.ngdoc | |
| parent | fc0b2b5715655a05cbb4c8e79969c95d7e7ce8b7 (diff) | |
| download | angular.js-f16150d5f1b20b3d633b4402095ea89baa4be042.tar.bz2 | |
docs(*): simplify doc urls
we now have two types of namespaces:
- true namespace: angular.* - used for all global apis
- virtual namespace: ng.*, ngMock.*, ... - used for all DI modules
the virual namespaces have services under the second namespace level (e.g. ng.)
and filters and directives prefixed with filter: and directive: respectively
(e.g. ng.filter:orderBy, ng.directive:ngRepeat)
this simplifies urls and makes them a lot shorter while still avoiding name collisions
Diffstat (limited to 'docs/content/guide/forms.ngdoc')
| -rw-r--r-- | docs/content/guide/forms.ngdoc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/docs/content/guide/forms.ngdoc b/docs/content/guide/forms.ngdoc index c21ffc93..b3bfcb30 100644 --- a/docs/content/guide/forms.ngdoc +++ b/docs/content/guide/forms.ngdoc @@ -12,9 +12,9 @@ Server-side validation is still necessary for a secure application. # Simple form -The key directive in understanding two-way data-binding is {@link api/angular.module.ng.$compileProvider.directive.ngModel ngModel}. +The key directive in understanding two-way data-binding is {@link api/ng.directive:ngModel ngModel}. The `ngModel` directive provides the two-way data-binding by synchronizing the model to the view, as well as view to the model. -In addition it provides {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController API} for other directives to augment its behavior. +In addition it provides {@link api/ng.directive:ngModel.NgModelController API} for other directives to augment its behavior. <doc:example> <doc:source> @@ -113,9 +113,9 @@ This ensures that the user is not distracted with an error until after interacti # Binding to form and control state -A form is in instance of {@link api/angular.module.ng.$compileProvider.directive.form.FormController FormController}. +A form is in instance of {@link api/ng.directive:form.FormController FormController}. The form instance can optionally be published into the scope using the `name` attribute. -Similarly control is an instance of {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController NgModelController}. +Similarly control is an instance of {@link api/ng.directive:ngModel.NgModelController NgModelController}. The control instance can similarly be published into the form instance using the `name` attribute. This implies that the internal state of both the form and the control is available for binding in the view using the standard binding primitives. @@ -178,19 +178,19 @@ This allows us to extend the above example with these features: # Custom Validation -Angular provides basic implementation for most common html5 {@link api/angular.module.ng.$compileProvider.directive.input input} -types: ({@link api/angular.module.ng.$compileProvider.directive.input.text text}, {@link api/angular.module.ng.$compileProvider.directive.input.number number}, {@link api/angular.module.ng.$compileProvider.directive.input.url url}, {@link api/angular.module.ng.$compileProvider.directive.input.email email}, {@link api/angular.module.ng.$compileProvider.directive.input.radio radio}, {@link api/angular.module.ng.$compileProvider.directive.input.checkbox checkbox}), as well as some directives for validation (`required`, `pattern`, `minlength`, `maxlength`, `min`, `max`). +Angular provides basic implementation for most common html5 {@link api/ng.directive:input input} +types: ({@link api/ng.directive:input.text text}, {@link api/ng.directive:input.number number}, {@link api/ng.directive:input.url url}, {@link api/ng.directive:input.email email}, {@link api/ng.directive:input.radio radio}, {@link api/ng.directive:input.checkbox checkbox}), as well as some directives for validation (`required`, `pattern`, `minlength`, `maxlength`, `min`, `max`). -Defining your own validator can be done by defining your own directive which adds a custom validation function to the `ngModel` {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController controller}. +Defining your own validator can be done by defining your own directive which adds a custom validation function to the `ngModel` {@link api/ng.directive:ngModel.NgModelController controller}. To get a hold of the controller the directive specifies a dependency as shown in the example below. The validation can occur in two places: * **Model to View update** - - Whenever the bound model changes, all functions in {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$formatters NgModelController#$formatters} array are pipe-lined, so that each of these functions has an opportunity to format the value and change validity state of the form control through {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$setValidity NgModelController#$setValidity}. + Whenever the bound model changes, all functions in {@link api/ng.directive:ngModel.NgModelController#$formatters NgModelController#$formatters} array are pipe-lined, so that each of these functions has an opportunity to format the value and change validity state of the form control through {@link api/ng.directive:ngModel.NgModelController#$setValidity NgModelController#$setValidity}. * **View to Model update** - - In a similar way, whenever a user interacts with a control, the controll calls {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$setViewValue NgModelController#$setViewValue}. -This in turn pipelines all functions in {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$parsers NgModelController#$parsers} array, so that each of these functions has an opportunity to convert the value and change validity state of the form control through {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$setValidity NgModelController#$setValidity}. + In a similar way, whenever a user interacts with a control, the controll calls {@link api/ng.directive:ngModel.NgModelController#$setViewValue NgModelController#$setViewValue}. +This in turn pipelines all functions in {@link api/ng.directive:ngModel.NgModelController#$parsers NgModelController#$parsers} array, so that each of these functions has an opportunity to convert the value and change validity state of the form control through {@link api/ng.directive:ngModel.NgModelController#$setValidity NgModelController#$setValidity}. In the following example we create two directives. @@ -273,12 +273,12 @@ In the following example we create two directives. # Implementing custom form control (using `ngModel`) -Angular implements all of the basic HTML form controls ({@link api/angular.module.ng.$compileProvider.directive.input input}, {@link api/angular.module.ng.$compileProvider.directive.select select}, {@link api/angular.module.ng.$compileProvider.directive.textarea textarea}), which should be sufficient for most cases. +Angular implements all of the basic HTML form controls ({@link api/ng.directive:input input}, {@link api/ng.directive:select select}, {@link api/ng.directive:textarea textarea}), which should be sufficient for most cases. However, if you need more flexibility, you can write your own form control as a directive. In order for custom control to work with `ngModel` and to achieve two-way data-binding it needs to: - - implement `render` method, which is responsible for rendering the data after it passed the {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$formatters NgModelController#$formatters}, + - implement `render` method, which is responsible for rendering the data after it passed the {@link api/ng.directive:ngModel.NgModelController#$formatters NgModelController#$formatters}, - call `$setViewValue` method, whenever the user interacts with the control and model needs to be updated. This is usually done inside a DOM Event listener. See {@link guide/directive $compileProvider.directive} for more info. |
