从Ionic2中的离子选择模式自动打开日期时间组件? [英] Automatically open the datetime component from an ion-select modal in Ionic2?
本文介绍了从Ionic2中的离子选择模式自动打开日期时间组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Ionic 2中,是否有一种方法可以在事件发生后自动打开日期时间组件,例如在离子选择模式中按确定"按钮?
In Ionic 2 is there a way to automatically open the datetime component after an event like pressing the OK button in an ion-select modal?
因此它将直接从按ok到在datetime组件上选择/拉出时间.
So it will go directly from pressing ok to selecting/pulling up a time on the datetime component.
我尚未找到直接执行此操作的解决方案.
I have yet to find a solution to directly do this.
推荐答案
我们在这里
在您的模板上:
<ion-datetime #dateTime style="display:none" displayFormat="h:mm A" pickerFormat="h mm A" [(ngModel)]="startTime"></ion-datetime>
<button (click)="openStart()"></button>
然后在您的代码中
首先创建对datetime控件的引用:
first create a reference to the datetime control:
@ViewChild('dateTime') sTime;
然后添加您的事件代码:
then add your event code:
openStart()
{
this.sTime.open();
}
干杯.
这篇关于从Ionic2中的离子选择模式自动打开日期时间组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文