docs(API): 翻译完了 FormBuilder

This commit is contained in:
Zhicheng Wang 2018-09-04 10:47:31 +08:00
parent 986872ecbd
commit 82ba447ca0
2 changed files with 41 additions and 1 deletions

View File

@ -50,7 +50,7 @@
[x] | common/CurrencyPipe | 0.39
[x] | router/RouterLinkActive | 0.38
[x] | core/TemplateRef | 0.38
[ ] | forms/FormBuilder | 0.37
[x] | forms/FormBuilder | 0.37
[ ] | common/http/HttpParams | 0.35
[ ] | core/OnChanges | 0.35
[ ] | forms/FormControlName | 0.34

View File

@ -15,12 +15,19 @@ import {AbstractControl, FormArray, FormControl, FormGroup} from './model';
* @description
* Creates an `AbstractControl` from a user-specified configuration.
*
* 使 `AbstractControl`
*
* The `FormBuilder` provides syntactic sugar that shortens creating instances of a `FormControl`,
* `FormGroup`, or `FormArray`. It reduces the amount of boilerplate needed to build complex
* forms.
*
* `FormBuilder` `FormControl``FormGroup` `FormArray`
*
*
* @see [Reactive Forms Guide](/guide/reactive-forms)
*
* [](/guide/reactive-forms)
*
*/
@Injectable()
export class FormBuilder {
@ -28,13 +35,25 @@ export class FormBuilder {
* @description
* Construct a new `FormGroup` instance.
*
* `FormGroup`
*
* @param controlsConfig A collection of child controls. The key for each child is the name
* under which it is registered.
*
* key
*
* @param extra An object of configuration options for the `FormGroup`.
*
* `FormGroup`
*
* * `validator`: A synchronous validator function, or an array of validator functions
*
* `validator`
*
* * `asyncValidator`: A single async validator or array of async validator functions
*
* `asyncValidator`
*
*/
group(controlsConfig: {[key: string]: any}, extra: {[key: string]: any}|null = null): FormGroup {
const controls = this._reduceControls(controlsConfig);
@ -47,20 +66,32 @@ export class FormBuilder {
* @description
* Construct a new `FormControl` instance.
*
* `FormControl`
*
* @param formState Initializes the control with an initial value,
* or an object that defines the initial value and disabled state.
*
* 使
*
* @param validator A synchronous validator function, or an array of synchronous validator
* functions.
*
*
*
* @param asyncValidator A single async validator or array of async validator functions
*
*
*
* @usageNotes
*
* ### Initialize a control as disabled
*
* ###
*
* The following example returns a control with an initial value in a disabled state.
*
*
*
* <code-example path="forms/ts/formBuilder/form_builder_example.ts"
* linenums="false" region="disabled-control">
* </code-example>
@ -76,13 +107,22 @@ export class FormBuilder {
* @description
* Construct a new `FormArray` instance.
*
* `FormArray`
*
* @param controlsConfig An array of child controls. The key for each child control is its index
* in the array.
*
* key
*
* @param validator A synchronous validator function, or an array of synchronous validator
* functions.
*
*
*
* @param asyncValidator A single async validator or array of async validator functions
*
*
*
*/
array(
controlsConfig: any[], validator?: ValidatorFn|ValidatorFn[]|null,