如何在Angular 2中使用日期选择器? [英] How to use date picker in Angular 2?
问题描述
事实上,您可以通过在<$ c中添加日期
值来使用datepicker $ c> type 您输入的属性:
< input type =date[ ngModel)] =company.birthdate/>
在Chrome和Microsoft Edge(不在Firefox中)的某些浏览器中,您可以点击输入显示日期选择器。只有当鼠标悬停在输入端时,图标才会出现。
要使浏览器有东西,您应该考虑使用符合Angular2的库,如:
I have tried many date picker in my angular2 app but none of them is working.Although the date picker is displaying on the view but the value of selected date is not getting in the ngModel variable.
In fact, you can use a datepicker by simply adding the date
value into the type
attribute of your inputs:
<input type="date" [(ngModel)]="company.birthdate"/>
In some browsers like Chrome and Microsoft Edge (not in Firefox), you can click on the icon within the input to display the date picker. Icons appear only when you mouse is over the input.
To have something cross browsers, you should consider to use Angular2 compliant libraries like:
这篇关于如何在Angular 2中使用日期选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!