简体   繁体   English

角日期选择器隐藏显示与按钮单击

[英]Angular date picker hide show with button click

I have 3 text boxes and a button. 我有3个文本框和一个按钮。 on button click, I want to show date picker and on select of date, I want to populate the date, month and year in those 3 text boxes. 单击按钮时,我想显示日期选择器,选择日期时,我想在这3个文本框中填充日期,月份和年份。

I tried using the library "ng2-datepicker". 我尝试使用库“ ng2-datepicker”。

<ng-datepicker [(ngModel)]="date" [options]="options" [isOpened]="isOpened" [position] = "position"></ng-datepicker>

<button (click)="isOpened = !isOpened">select</button>

Here "isOpened" property controls the show hide of date picker and visible as a single textbox. 此处的“ isOpened”属性控制日期选择器的显示隐藏,并显示为单个文本框。 I am not able to perform the show hide also. 我也无法执行秀皮。 But passing true or false directly works 但是直接传递正确或错误是可行的

Also, I am not finding a proper solution to achieve this with 3 text boxes. 另外,我找不到3个文本框来实现这一目标的合适解决方案。 Please provide if you found some useful links on click of a button 如果您单击按钮后发现一些有用的链接,请提供

Note: I don't want to use Jquery controls 注意:我不想使用Jquery控件

Have you tried ngx-bootstrap ? 您尝试过ngx-bootstrap吗? It's quite verbose and works well for me. 这很冗长,对我来说效果很好。 If you still want to use ng2-datepicker in your solution - maybe setup a Stackblitz replicate your problem so we can try to solve it. 如果您仍想在解决方案中使用ng2-datepicker,则可以设置Stackblitz复制您的问题,以便我们尝试解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM