javascript - 角日期选择器空值
问题描述
这是我的代码。我有一个显示日期选择器的对话框。日期选择器总是以日期打开,但是如果IsPrimerExists
值为 false,我希望日期选择器为空。我怎样才能做到这一点?
HTML:
<mat-form-field appearance="outline" *ngIf="!productionValue1">
<mat-label>{{'İmalat Tarihi(' + Country1 +' '+Market1+')'}}</mat-label>
<input matInput [matDatepickerFilter]="filterWeekend" [matDatepicker]="picker" [(ngModel)]="countryDate1"
name="countryDate1">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
IProductionOrder 接口:
IsPrimerExists?: boolean;
解决方案
选择器是绑定的 [(ngModel)]="countryDate1"
,所以如果你将 countryDate1 设置为 null 那么我猜它会在没有日期的情况下打开
推荐阅读
- opengl - 如何用另一个四边形掩盖 OpenGL 四边形
- python - 从 Dataframe 列中提取标签
- python - 需要在最后 5 个日期时间(时间戳)之前选择 pandas.DataFrame 的行
- vue.js - 在脚本中使用 vue-i18n
- python - 在子图的同一 y 轴上绘制不同比例的数据
- c - sizeof 如何处理指向数组的指针的取消引用?
- python - Scipy optimize curve_fit 在拟合自定义函数时为相同参数提供不同的图
- java - Flutter:如何将原生 SDK(Spotify Android SDK)添加到应用程序?
- c# - 有没有办法在不维护 C# 中的大写/小写的情况下获取字符串是否有子字符串?
- python - 在 DST 更改发生时将字符串解析为日期