Skip to content

Commit

Permalink
fix(select): set disabled state from FormControl
Browse files Browse the repository at this point in the history
  • Loading branch information
brandyscarney committed Jan 12, 2017
1 parent 8e64a28 commit 40e7eb2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,13 @@ export class Select extends Ion implements AfterContentInit, ControlValueAccesso
*/
onTouched() { }

/**
* @private
*/
setDisabledState(isDisabled: boolean) {
this.disabled = isDisabled;
}

/**
* @private
*/
Expand Down
6 changes: 6 additions & 0 deletions src/components/select/test/single-value/app-module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, NgModule } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { IonicApp, IonicModule } from '../../../..';

export interface Currency {
Expand Down Expand Up @@ -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];
}
Expand Down
12 changes: 12 additions & 0 deletions src/components/select/test/single-value/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 40e7eb2

Please sign in to comment.