Skip to content

Commit 40e7eb2

Browse files
committedJan 12, 2017
fix(select): set disabled state from FormControl
1 parent 8e64a28 commit 40e7eb2

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

‎src/components/select/select.ts

+7
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,13 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
487487
*/
488488
onTouched() { }
489489

490+
/**
491+
* @private
492+
*/
493+
setDisabledState(isDisabled: boolean) {
494+
this.disabled = isDisabled;
495+
}
496+
490497
/**
491498
* @private
492499
*/

‎src/components/select/test/single-value/app-module.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component, NgModule } from '@angular/core';
2+
import { FormControl, FormGroup } from '@angular/forms';
23
import { IonicApp, IonicModule } from '../../../..';
34

45
export interface Currency {
@@ -55,6 +56,11 @@ export class E2EPage {
5556
];
5657
currency: Currency;
5758

59+
fruitCtrl = new FormControl({value: 'grape', disabled: true});
60+
fruitsForm = new FormGroup({
61+
'fruit': this.fruitCtrl
62+
});
63+
5864
constructor() {
5965
this.currency = this.currencies[0];
6066
}

‎src/components/select/test/single-value/main.html

+12
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,16 @@
125125
<br>
126126
</p>
127127

128+
<form [formGroup]="fruitsForm">
129+
<ion-item>
130+
<ion-label>formControlName, disabled</ion-label>
131+
<ion-select formControlName="fruit">
132+
<ion-option>Grape</ion-option>
133+
<ion-option>Cherry</ion-option>
134+
<ion-option>Strawberry</ion-option>
135+
<ion-option>Mango</ion-option>
136+
</ion-select>
137+
</ion-item>
138+
</form>
139+
128140
</ion-content>

0 commit comments

Comments
 (0)
Please sign in to comment.