始终显示日期选择器中的日历-Angular [英] Always showing the calendar from datepicker - Angular

查看:163
本文介绍了始终显示日期选择器中的日历-Angular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使Angular中的datepicker始终可见.日历将始终可见,而无需依赖按钮(无需单击按钮)

I need to have the datepicker in Angular always visible. The calendar will be always visible without the dependency on the button (don't need to click on the button)

示例

源.html

<mat-form-field>
  <input matInput [matDatepicker]="picker" placeholder="Choose a date">
  <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
  <mat-datepicker #picker></mat-datepicker>
</mat-form-field>

推荐答案

您可以为此使用mat-calendar:

<mat-calendar [selected]="selectedDate" (selectedChange)="selectedDate = $event"></mat-calendar>

这篇关于始终显示日期选择器中的日历-Angular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆