mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(datetime): set disabled state from FormControl
This commit is contained in:
@@ -860,6 +860,13 @@ export class DateTime extends Ion implements AfterContentInit, ControlValueAcces
|
||||
*/
|
||||
onTouched() { }
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
setDisabledState(isDisabled: boolean) {
|
||||
this.disabled = isDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
|
||||
46
src/components/datetime/test/form/app-module.ts
Normal file
46
src/components/datetime/test/form/app-module.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { IonicApp, IonicModule } from '../../../..';
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
templateUrl: 'main.html'
|
||||
})
|
||||
export class E2EPage {
|
||||
stackedCtrl = new FormControl('1994-12-15T13:47:20.789');
|
||||
floatingCtrl = new FormControl('1995-04-15');
|
||||
fixedCtrl = new FormControl({value: '2002-09-23T15:03:46.789', disabled: true});
|
||||
inlineCtrl = new FormControl({value: '2005-06-17T11:06Z', disabled: true});
|
||||
|
||||
datetimeForm = new FormGroup({
|
||||
'stacked': this.stackedCtrl,
|
||||
'floating': this.floatingCtrl,
|
||||
'fixed': this.fixedCtrl,
|
||||
'inline': this.inlineCtrl
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
export class E2EApp {
|
||||
root = E2EPage;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
E2EApp,
|
||||
E2EPage
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(E2EApp)
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
E2EPage
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
32
src/components/datetime/test/form/main.html
Normal file
32
src/components/datetime/test/form/main.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-toolbar>
|
||||
<ion-title>Datetime</ion-title>
|
||||
</ion-toolbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content class="outer-content">
|
||||
<form [formGroup]="datetimeForm">
|
||||
<ion-item>
|
||||
<ion-label stacked>Stacked</ion-label>
|
||||
<ion-datetime formControlName="stacked"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label floating>Floating</ion-label>
|
||||
<ion-datetime formControlName="floating" displayFormat="MMMM YY"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label fixed>Fixed</ion-label>
|
||||
<ion-datetime formControlName="fixed" displayFormat="MM/DD/YYYY"></ion-datetime>
|
||||
</ion-item>
|
||||
|
||||
<ion-item>
|
||||
<ion-label>Inline</ion-label>
|
||||
<ion-datetime formControlName="inline" displayFormat="MM/DD/YYYY"></ion-datetime>
|
||||
</ion-item>
|
||||
</form>
|
||||
</ion-content>
|
||||
Reference in New Issue
Block a user