Skip to content

Commit

Permalink
fix(datetime): use spread operator to copy pickerOptions to keep func…
Browse files Browse the repository at this point in the history
…tions

fixes #11641
  • Loading branch information
brandyscarney committed Oct 19, 2017
1 parent 22747e3 commit fa1985b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/datetime/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ export class DateTime extends BaseInput<DateTimeData> implements AfterContentIni
console.debug('datetime, open picker');

// the user may have assigned some options specifically for the alert
const pickerOptions = deepCopy(this.pickerOptions);
const pickerOptions = {...this.pickerOptions};

// Configure picker under the hood
const picker = this._picker = this._pickerCtrl.create(pickerOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<ion-item>
<ion-label>MM DD YY</ion-label>
<ion-datetime pickerFormat="YYYY-MM-DDThh:mm" [(ngModel)]="placeholderDate" placeholder="Select Date"></ion-datetime>
<ion-datetime pickerFormat="YYYY-MM-DDThh:mm" [pickerOptions]="customOptions" [(ngModel)]="placeholderDate" placeholder="Select Date"></ion-datetime>
</ion-item>

<ion-item>
Expand Down
10 changes: 10 additions & 0 deletions src/components/datetime/test/basic/pages/root-page/root-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ export class RootPage {
'l\u00f8r'
];

customOptions: any = {
buttons: [{
text: 'Save',
handler: () => console.log('Clicked Save!')
}, {
text: 'Log',
handler: () => console.log('Clicked Log!')
}]
};

onChange(ev: any) {
console.log('Changed', ev);
}
Expand Down

0 comments on commit fa1985b

Please sign in to comment.