我想保留mat-datepicker
在特定的 div 中打开。我用了opened=true
属性,但在选择日期后就会关闭。
这应该适合你:
将其添加到您的input
(click)="_openCalendar(picker)"
#keepOpen
这给你的mat-datepicker
(closed)="_openCalendar(picker)"
这是你的打字稿:
@ViewChild('keepOpen') _input: ElementRef;
_openCalendar(picker: MatDatepicker<Date>) {
picker.open();
}
不要忘记导入ViewChild
and ElementRef
这是我的工作样本斯塔克闪电战
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)