docs(API): 翻译完了 NgForm

This commit is contained in:
Zhicheng Wang 2018-09-02 22:28:11 +08:00
parent fe5c6d0a11
commit 78248db322
2 changed files with 23 additions and 1 deletions

View File

@ -38,7 +38,7 @@
[x] | common/http/HttpHeaders | 0.56
[x] | core/Pipe | 0.52
[x] | common/NgSwitch | 0.52
[ ] | forms/NgForm | 0.50
[x] | forms/NgForm | 0.50
[ ] | core/Renderer2 | 0.49
[x] | core/HostListener | 0.47
[ ] | common/AsyncPipe | 0.45

View File

@ -31,23 +31,35 @@ const resolvedPromise = Promise.resolve(null);
* Creates a top-level `FormGroup` instance and binds it to a form
* to track aggregate form value and validation status.
*
* `FormGroup`
*
* As soon as you import the `FormsModule`, this directive becomes active by default on
* all `<form>` tags. You don't need to add a special selector.
*
* `FormsModule` `<form>`
*
* You can export the directive into a local template variable using `ngForm` as the key
* (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
* `FormGroup` instance are duplicated on the directive itself, so a reference to it
* will give you access to the aggregate value and validity status of the form, as well as
* user interaction properties like `dirty` and `touched`.
*
* `ngForm` key `#myForm="ngForm"`
* `FormGroup` 访
* `dirty` `touched`
*
* To register child controls with the form, you'll want to use `NgModel` with a
* `name` attribute. You can also use `NgModelGroup` if you'd like to create
* sub-groups within the form.
*
* 使 `name` `NgModel`使 `NgModelGroup`
*
* You can listen to the directive's `ngSubmit` event to be notified when the user has
* triggered a form submission. The `ngSubmit` event will be emitted with the original form
* submission event.
*
* `ngSubmit` 便 `ngSubmit` DOM
*
* In template driven forms, all `<form>` tags are automatically tagged as `NgForm`.
* If you want to import the `FormsModule` but skip its usage in some forms,
* for example, to use native HTML5 validation, you can add `ngNoForm` and the `<form>`
@ -55,6 +67,11 @@ const resolvedPromise = Promise.resolve(null);
* unnecessary because the `<form>` tags are inert. In that case, you would
* refrain from using the `formGroup` directive.
*
* `<form>` `NgForm`
* `FormsModule` 使 HTML5 `ngNoForm`
* `<form>` `NgForm`
* `ngNoForm` `NgForm` `<form>` `formGroup`
*
* {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* * **npm package**: `@angular/forms`
@ -82,10 +99,15 @@ export class NgForm extends ControlContainer implements Form,
/**
* Options for the `NgForm` instance. Accepts the following properties:
*
* `NgForm`
*
* **updateOn**: Serves as the default `updateOn` value for all child `NgModels` below it
* (unless a child has explicitly set its own value for this in `ngModelOptions`).
* Potential values: `'change'` | `'blur'` | `'submit'`
*
* **updateOn** `NgModel` `updateOn` `NgModel` `ngModelOptions`
* `'change'` | `'blur'` | `'submit'`
*
* ```html
* <form [ngFormOptions]="{updateOn: 'blur'}">
* <input name="one" ngModel> <!-- this ngModel will update on blur -->