Skip to content

ion-datetime value doesnt change when ngModel is changed #6614

Closed
@keithdmoore

Description

@keithdmoore

When you have a select on the page that selects the ngModel, the value for the ngModel in ion-datetime does not change to reflect the selection change.

I was expecting the value to change since the model has changed. Basically, I expect the ion-datetime component to behave like other ion-inputs.

Steps to reproduce:

  1. Default the model to a value
  2. Select a date/time
  3. Change the model using a select.
  4. Note that the value in the ion-datetime doesnt change.
  <ion-item>
      <ion-label stacked>Item Number</ion-label>
      <ion-select [(ngModel)]="currentItem">
        <ion-option *ngFor="let item of myItems" [value]="item">{{ item.itemNumber }}</ion-option>
      </ion-select>
      </ion-item>  
  <ion-item>
    <ion-label stacked>Item description</ion-label>
    <ion-input [(ngModel)]="currentItem.desc"></ion-input>
  </ion-item>
  <ion-item>
    <ion-label stacked>Date</ion-label>
    <ion-datetime displayFormat="MMM DD, YYYY HH:mm" [(ngModel)]="currentItem.itemDate"></ion-datetime>
  </ion-item> 

Occurs in: Ionic2

http://plnkr.co/edit/QLCot4Q06nJhH8w1iw1c?p=preview

Cordova CLI: 6.1.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.7
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: 1.8.5
ios-sim version: 3.1.1
OS: Mac OS X El Capitan
Node Version: v5.8.0
Xcode version: Xcode 7.3.1 Build version 7D1014

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions