Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f363bcb

Browse files
jdavisp3petebacondarwin
authored andcommitted
docs(ngForm): fix grammar and improve explanation
Closes angular#4050
1 parent 7b2259f commit f363bcb

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/ng/directive/form.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,19 @@ function FormController(element, attrs) {
188188
* Directive that instantiates
189189
* {@link ng.directive:form.FormController FormController}.
190190
*
191-
* If `name` attribute is specified, the form controller is published onto the current scope under
191+
* If the `name` attribute is specified, the form controller is published onto the current scope under
192192
* this name.
193193
*
194194
* # Alias: {@link ng.directive:ngForm `ngForm`}
195195
*
196-
* In angular forms can be nested. This means that the outer form is valid when all of the child
197-
* forms are valid as well. However browsers do not allow nesting of `<form>` elements, for this
198-
* reason angular provides {@link ng.directive:ngForm `ngForm`} alias
199-
* which behaves identical to `<form>` but allows form nesting.
196+
* In Angular forms can be nested. This means that the outer form is valid when all of the child
197+
* forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
198+
* Angular provides the {@link ng.directive:ngForm `ngForm`} directive which behaves identically to
199+
* `<form>` but can be nested. This allows you to have nested forms, which is very useful when
200+
* using Angular validation directives in forms that are dynamically generated using the
201+
* {@link ng.directive:ngRepeat `ngRepeat`} directive. Since you cannot dynamically generate the `name`
202+
* attribute of input elements using interpolation, you have to wrap each set of repeated inputs in an
203+
* `ngForm` directive and nest these in an outer `form` element.
200204
*
201205
*
202206
* # CSS classes
@@ -206,12 +210,12 @@ function FormController(element, attrs) {
206210
* - `ng-dirty` Is set if the form is dirty.
207211
*
208212
*
209-
* # Submitting a form and preventing default action
213+
* # Submitting a form and preventing the default action
210214
*
211215
* Since the role of forms in client-side Angular applications is different than in classical
212216
* roundtrip apps, it is desirable for the browser not to translate the form submission into a full
213217
* page reload that sends the data to the server. Instead some javascript logic should be triggered
214-
* to handle the form submission in application specific way.
218+
* to handle the form submission in an application-specific way.
215219
*
216220
* For this reason, Angular prevents the default action (form submission to the server) unless the
217221
* `<form>` element has an `action` attribute specified.
@@ -223,8 +227,9 @@ function FormController(element, attrs) {
223227
* - {@link ng.directive:ngClick ngClick} directive on the first
224228
* button or input field of type submit (input[type=submit])
225229
*
226-
* To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This
227-
* is because of the following form submission rules coming from the html spec:
230+
* To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
231+
* or {@link ng.directive:ngClick ngClick} directives.
232+
* This is because of the following form submission rules in the HTML specification:
228233
*
229234
* - If a form has only one input field then hitting enter in this field triggers form submit
230235
* (`ngSubmit`)

0 commit comments

Comments
 (0)