docs(API): 翻译完了 NgSelectOption

This commit is contained in:
Zhicheng Wang 2018-09-05 09:46:21 +08:00
parent 7b2226516a
commit badf927f37
2 changed files with 38 additions and 2 deletions

View File

@ -93,7 +93,7 @@
[x] | core/PipeTransform | 0.18
[x] | core/SimpleChange | 0.18
[x] | core/SimpleChanges | 0.18
[ ] | forms/NgSelectOption | 0.17
[x] | forms/NgSelectOption | 0.17
[ ] | common/PercentPipe | 0.17
[ ] | forms/ValidatorFn | 0.17
[ ] | http/RequestOptionsArgs | 0.17

View File

@ -31,43 +31,71 @@ function _extractId(valueString: string): string {
*
* Writes values and listens to changes on a select element.
*
* `select`
*
* Used by `NgModel`, `FormControlDirective`, and `FormControlName`
* to keep the view synced with the `FormControl` model.
*
* `NgModel``FormControlDirective` `FormControlName` 使
* `FormControl`
*
* If you have imported the `FormsModule` or the `ReactiveFormsModule`, this
* value accessor will be active on any select control that has a form directive. You do
* **not** need to add a special selector to activate it.
*
* `FormsModule` `ReactiveFormsModule`"值访问器"`ValueAccessor` `select`
* ****
*
* ### How to use select controls with form directives
*
* ### 使 `select`
*
* To use a select in a template-driven form, simply add an `ngModel` and a `name`
* attribute to the main `<select>` tag.
*
* 使 `select` `ngModel` `name` `<select>`
*
* If your option values are simple strings, you can bind to the normal `value` property
* on the option. If your option values happen to be objects (and you'd like to save the
* selection in your form as an object), use `ngValue` instead:
*
* `option` `option` `value`
* `ngValue`
*
* {@example forms/ts/selectControl/select_control_example.ts region='Component'}
*
* In reactive forms, you'll also want to add your form directive (`formControlName` or
* `formControl`) on the main `<select>` tag. Like in the former example, you have the
* choice of binding to the `value` or `ngValue` property on the select's options.
*
* `formControlName` `formControl` `<select>`
* `option` `value` `ngValue`
*
* {@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'}
*
* ### Caveat: Option selection
*
* ### `option`
*
* Angular uses object identity to select option. It's possible for the identities of items
* to change while the data does not. This can happen, for example, if the items are produced
* from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
* second response will produce objects with different identities.
*
* Angular 使 RPC RPC
*
* To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
* `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
* If `compareWith` is given, Angular selects option by the return value of the function.
*
* `<select>` `compareWith`
* `compareWith` ****`option1` `option2`
* `compareWith` Angular
*
* #### Syntax
*
* ####
*
* ```
* <select [compareWith]="compareFn" [(ngModel)]="selectedCountries">
* <option *ngFor="let country of countries" [ngValue]="country">
@ -85,8 +113,14 @@ function _extractId(valueString: string): string {
* https://bugzilla.mozilla.org/show_bug.cgi?id=1024350
* https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/
*
* `change` `input` Firefox IE `select`
* https://bugzilla.mozilla.org/show_bug.cgi?id=1024350
* https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/
*
* * **npm package**: `@angular/forms`
*
* **npm **: `@angular/forms`
*
*
*/
@Directive({
@ -162,9 +196,11 @@ export class SelectControlValueAccessor implements ControlValueAccessor {
*
* Marks `<option>` as dynamic, so Angular can be notified when options change.
*
* `<option>` Angular
*
* See docs for `SelectControlValueAccessor` for usage examples.
*
*
* `SelectControlValueAccessor` 使
*/
@Directive({selector: 'option'})
export class NgSelectOption implements OnDestroy {