mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
refactor(select): rename the checked attribute to selected on option
BREAKING CHANGES: The Option component’s `checked` attribute has been renamed to `selected` in order to select an option. This is to the follow the MDN spec for a select option: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option If a `ngModel` is added to the Select component the value of the `ngModel` will take precedence over the `selected` attribute. references #7334
This commit is contained in:
@ -5,7 +5,7 @@ import { isPresent, isTrueProperty } from '../../util/util';
|
||||
/**
|
||||
* @name Option
|
||||
* @description
|
||||
* `ion-option` is a child component of `ion-select`. Similar to the native option element, `ion-option` can take a value and a checked property.
|
||||
* `ion-option` is a child component of `ion-select`. Similar to the native option element, `ion-option` can take a value and a selected property.
|
||||
*
|
||||
* @demo /docs/v2/demos/item-sliding/
|
||||
*/
|
||||
@ -13,7 +13,7 @@ import { isPresent, isTrueProperty } from '../../util/util';
|
||||
selector: 'ion-option'
|
||||
})
|
||||
export class Option {
|
||||
private _checked: any = false;
|
||||
private _selected: any = false;
|
||||
private _disabled: any = false;
|
||||
private _value: any;
|
||||
|
||||
@ -25,15 +25,15 @@ export class Option {
|
||||
constructor(private _elementRef: ElementRef) {}
|
||||
|
||||
/**
|
||||
* @input {boolean} Whether or not the option is already checked and selected
|
||||
* @input {boolean} Whether or not the option is already selected
|
||||
*/
|
||||
@Input()
|
||||
get checked() {
|
||||
return this._checked;
|
||||
get selected() {
|
||||
return this._selected;
|
||||
}
|
||||
|
||||
set checked(val) {
|
||||
this._checked = isTrueProperty(val);
|
||||
set selected(val) {
|
||||
this._selected = isTrueProperty(val);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user