aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/form.js
diff options
context:
space:
mode:
authorDave Peticolas2013-09-18 17:06:29 -0700
committerPete Bacon Darwin2013-09-19 10:28:34 +0100
commita1c4f6fbb70d8cbc99d23928a03e554807e9ee22 (patch)
tree54ce3a7fca5ca8d786b21fb49b67f3456a60e5ef /src/ng/directive/form.js
parent04c9cae5d9c69ebc488e5079b614f0cca1fd09f1 (diff)
downloadangular.js-a1c4f6fbb70d8cbc99d23928a03e554807e9ee22.tar.bz2
docs(ngForm): fix grammar and improve explanation
Closes #4050
Diffstat (limited to 'src/ng/directive/form.js')
-rw-r--r--src/ng/directive/form.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js
index 00e8f287..ed9d7052 100644
--- a/src/ng/directive/form.js
+++ b/src/ng/directive/form.js
@@ -217,15 +217,19 @@ function FormController(element, attrs) {
* Directive that instantiates
* {@link ng.directive:form.FormController FormController}.
*
- * If `name` attribute is specified, the form controller is published onto the current scope under
+ * If the `name` attribute is specified, the form controller is published onto the current scope under
* this name.
*
* # Alias: {@link ng.directive:ngForm `ngForm`}
*
- * In angular forms can be nested. This means that the outer form is valid when all of the child
- * forms are valid as well. However browsers do not allow nesting of `<form>` elements, for this
- * reason angular provides {@link ng.directive:ngForm `ngForm`} alias
- * which behaves identical to `<form>` but allows form nesting.
+ * In Angular forms can be nested. This means that the outer form is valid when all of the child
+ * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+ * Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
+ * `<form>` but can be nested. This allows you to have nested forms, which is very useful when
+ * using Angular validation directives in forms that are dynamically generated using the
+ * {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`
+ * attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an
+ * `ngForm` directive and nest these in an outer `form` element.
*
*
* # CSS classes
@@ -235,12 +239,12 @@ function FormController(element, attrs) {
* - `ng-dirty` Is set if the form is dirty.
*
*
- * # Submitting a form and preventing default action
+ * # Submitting a form and preventing the default action
*
* Since the role of forms in client-side Angular applications is different than in classical
* roundtrip apps, it is desirable for the browser not to translate the form submission into a full
* page reload that sends the data to the server. Instead some javascript logic should be triggered
- * to handle the form submission in application specific way.
+ * to handle the form submission in an application-specific way.
*
* For this reason, Angular prevents the default action (form submission to the server) unless the
* `<form>` element has an `action` attribute specified.
@@ -252,8 +256,9 @@ function FormController(element, attrs) {
* - {@link ng.directive:ngClick ngClick} directive on the first
* button or input field of type submit (input[type=submit])
*
- * To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This
- * is because of the following form submission rules coming from the html spec:
+ * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+ * or {@link ng.directive:ngClick ngClick} directives.
+ * This is because of the following form submission rules in the HTML specification:
*
* - If a form has only one input field then hitting enter in this field triggers form submit
* (`ngSubmit`)