mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +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() { }
|
onTouched() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
setDisabledState(isDisabled: boolean) {
|
||||||
|
this.disabled = isDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, NgModule } from '@angular/core';
|
import { Component, NgModule } from '@angular/core';
|
||||||
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { IonicApp, IonicModule } from '../../../..';
|
import { IonicApp, IonicModule } from '../../../..';
|
||||||
|
|
||||||
export interface Currency {
|
export interface Currency {
|
||||||
@ -55,6 +56,11 @@ export class E2EPage {
|
|||||||
];
|
];
|
||||||
currency: Currency;
|
currency: Currency;
|
||||||
|
|
||||||
|
fruitCtrl = new FormControl({value: 'grape', disabled: true});
|
||||||
|
fruitsForm = new FormGroup({
|
||||||
|
'fruit': this.fruitCtrl
|
||||||
|
});
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.currency = this.currencies[0];
|
this.currency = this.currencies[0];
|
||||||
}
|
}
|
||||||
|
@ -125,4 +125,16 @@
|
|||||||
<br>
|
<br>
|
||||||
</p>
|
</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>
|
</ion-content>
|
||||||
|
Reference in New Issue
Block a user