In html page, four <ion-datetime> pickers are working same functionality

Can you please help me. I had a problem with ionic 2. If I am using two or more same type of elements in html page, like button or datetime etc. If I click on any one of the items, it can works only last added item functionality in the html page.
Thank you

How would you suggest somebody go about attempting to reproduce this problem?

my code is

       <ion-content padding>
       <div>
       <ion-icon color="navy" name="calendar"></ion-icon>  From Date:
       <ion-datetime displayFormat="DD-MMMM-YYYY" [(ngModel)]="today" end></ion-datetime>
       <ion-icon color="navy" name="calendar"></ion-icon> To Date:
       <ion-datetime displayFormat="DD-MMMM-YYYY" [(ngModel)]="today" end></ion-datetime>

   <ion-item>           
	<ion-label>Scan Type</ion-label>
	<ion-select [(ngModel)]="Type">
	<ion-option value="full" selected="true">Full </ion-option>
	        <ion-option value="category">Category</ion-option>
	</ion-select>
   </ion-item>
	<br>
      <ion-col>
       <ion-icon color="navy" name="calendar"></ion-icon> From Time:
         <ion-datetime displayFormat="hh:mm A" [(ngModel)]="today" end></ion-datetime>   
     </ion-col>           
       
       <ion-icon color="navy" name="calendar"></ion-icon> To Time:
       <ion-datetime displayFormat="hh:mm a" [(ngModel)]="today" end></ion-datetime>
   <button ion-button block color="navy" (click)="add()"> Add Schedule</button>
     </div>

    </ion-content>

I must be missing something really obvious, but I see only one button in there.

may be his question something is with datepicker . he have 4 datepicker having same binding variable

1 Like

Thank you for interact.
Yes, my problem with < ion-datetime > .Date picker is opening even I click on < ion-select >. I have four < ion-datetime > fields. In the total page only button is working perfect and remaining all are open only time picker. I used two date pickers and two time pickers. All < ion-datetime > are calling last added < ion-datetime > item function of time picker.
I hope you understand my problem.

use them in ion-item (ion-list).

2 Likes

Thank you!
It’s working.:slight_smile: