fix(select): set disabled state from FormControl

This commit is contained in:
Brandy Carney
2017-01-12 17:03:00 -05:00
parent 8e64a28ed3
commit 40e7eb2350
3 changed files with 25 additions and 0 deletions

View File

@ -487,6 +487,13 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
*/
onTouched() { }
/**
* @private
*/
setDisabledState(isDisabled: boolean) {
this.disabled = isDisabled;
}
/**
* @private
*/

View File

@ -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];
}

View File

@ -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>