mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(select): set disabled state from FormControl
This commit is contained in:
@ -487,6 +487,13 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
|
||||
*/
|
||||
onTouched() { }
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setDisabledState(isDisabled: boolean) {
|
||||
this.disabled = isDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { IonicApp, IonicModule } from '../../../..';
|
||||
|
||||
export interface Currency {
|
||||
@ -55,6 +56,11 @@ export class E2EPage {
|
||||
];
|
||||
currency: Currency;
|
||||
|
||||
fruitCtrl = new FormControl({value: 'grape', disabled: true});
|
||||
fruitsForm = new FormGroup({
|
||||
'fruit': this.fruitCtrl
|
||||
});
|
||||
|
||||
constructor() {
|
||||
this.currency = this.currencies[0];
|
||||
}
|
||||
|
@ -125,4 +125,16 @@
|
||||
<br>
|
||||
</p>
|
||||
|
||||
<form [formGroup]="fruitsForm">
|
||||
<ion-item>
|
||||
<ion-label>formControlName, disabled</ion-label>
|
||||
<ion-select formControlName="fruit">
|
||||
<ion-option>Grape</ion-option>
|
||||
<ion-option>Cherry</ion-option>
|
||||
<ion-option>Strawberry</ion-option>
|
||||
<ion-option>Mango</ion-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
</form>
|
||||
|
||||
</ion-content>
|
||||
|
Reference in New Issue
Block a user