Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70915

Is there any way in ionic 5 to open ion-datepicker from an ion-select?

$
0
0

What I want to achieve is when I click on ion-select to open an ion-datetime.

What I achieved so far is opening from an ion-item, but it’s quite hard to customise to make it look as an ion-select.

I saw some posts in here using DatePicker from ionic-angular, but this doesn’t work anymore for ionic 5. If you have any suggestions that would be amazing. Thanks!

my HTML

<ion-item class="dateItem"(click)="openDatePicker()">Date of birth </ion-item>
              <ion-datetime
                formControlName="combinedSelects"
                value="dob"
                #dateTime
                style="display: none;">
              </ion-datetime>

My TS

import { Component, OnInit, ViewChild } from "@angular/core";
import { FormGroup, FormControl, Validators } from "@angular/forms";

@Component({
  selector: "app-combined-selects",
  templateUrl: "./combined-selects.component.html",
  styleUrls: ["./combined-selects.component.scss"],
})
export class CombinedSelectsComponent implements OnInit {
  date: String;
  @ViewChild("dateTime") showDate;

  constructor() {}

  ngOnInit() {}

  openDatePicker() {
    this.showDate.open();
  }
}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70915

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>