[英]mat-datepicker add touchUI condition
I have an ionic application in which I use Angular's mat-datepicker. 我在离子应用程序中使用Angular的mat-datepicker。 I want for the web version to get the normal date-picker and on the mobile devices to get the touchUi version.
我想让网络版本获得正常的日期选择器,并希望在移动设备上获得touchUi版本。 I tried putting *ngIf for the mat-date-picker selector but I start getting
'Cannot read property open of undefined'
我尝试将* ngIf用作mat-date-picker选择器,但开始出现
'Cannot read property open of undefined'
<mat-form-field class="day-datepicker">
<input [(ngModel)]="FilterOptions.CreatedTo" disabled matInput [matDatepicker]="picker4">
<mat-datepicker #picker4 *ngIf="_AppConfig.IsCordova" touchUi="true" disabled="false">
</mat-datepicker>
<mat-datepicker #picker4 *ngIf="!_AppConfig.IsCordova" disabled="false">
</mat-datepicker>
</mat-form-field>
You need to change your code like below. 您需要像下面那样更改代码。
<mat-form-field class="day-datepicker">
<input [(ngModel)]="FilterOptions.CreatedTo" disabled matInput [matDatepicker]="picker4">
<mat-datepicker-toggle matSuffix [for]="picker4"></mat-datepicker-toggle>
<mat-datepicker #picker4 [touchUi]="_AppConfig.IsCordova" disabled="false"></mat-datepicker>
</mat-form-field>`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.