mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(select): correctly document usage for selected elements (#10969)
The current documentation has `selected="true"` combined with `ngModel` binding, but this does not work. In fact, the demo on the page does not use `selected`. I removed this from the example code. I also added a paragraph explaining how to set an option as selected.
This commit is contained in:
committed by
Brandy Carney
parent
df269bf7fb
commit
0e4c1b726a
@@ -30,6 +30,10 @@ export const SELECT_VALUE_ACCESSOR: any = {
|
||||
* The select component takes child `ion-option` components. If `ion-option` is not
|
||||
* given a `value` attribute then it will use its text as the value.
|
||||
*
|
||||
* If `ngModel` is bound to `ion-select`, the selected value will be based on the
|
||||
* bound value of the model. Otherwise, the `selected` attribute can be used on
|
||||
* `ion-option` components.
|
||||
*
|
||||
* ### Interfaces
|
||||
*
|
||||
* By default, the `ion-select` uses the {@link ../../alert/AlertController AlertController API}
|
||||
@@ -51,7 +55,7 @@ export const SELECT_VALUE_ACCESSOR: any = {
|
||||
* <ion-item>
|
||||
* <ion-label>Gender</ion-label>
|
||||
* <ion-select [(ngModel)]="gender">
|
||||
* <ion-option value="f" selected="true">Female</ion-option>
|
||||
* <ion-option value="f">Female</ion-option>
|
||||
* <ion-option value="m">Male</ion-option>
|
||||
* </ion-select>
|
||||
* </ion-item>
|
||||
|
||||
Reference in New Issue
Block a user