[英]Angular Material Date Picker adding horizontal line
When I copy the DatePicker example from the Angular Material website it's adding an extra horizontal line to the bottom of it and I can't figure out why.当我从 Angular Material 网站复制 DatePicker 示例时,它会在底部添加一条额外的水平线,但我不知道为什么。
Here's the example:这是示例:
<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>
And here's a screenshot:这是一个屏幕截图:
this problem is because you are using the angular material and also the cdn of materialize or materialize style.这个问题是因为您使用的是angular material以及materialize或materialize样式的cdn。 you could delete this line:
你可以删除这一行:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
and the line of the datepicker will be ok, and then, you could use other grid system for de rows and cols.并且日期选择器的行就可以了,然后,您可以使用其他网格系统进行行和列。 for example: https://github.com/angular/flex-layout
例如: https : //github.com/angular/flex-layout
I am just leaving this here in case someone else makes the same mistake I did.我只是把这个留在这里,以防其他人犯和我一样的错误。 In my case I accidentally copy and pasted the date picker code inside an existing
mat-form-field
.就我而言,我不小心将日期选择器代码复制并粘贴到现有
mat-form-field
。 I didn't notice it at first because of all the markup.由于所有的标记,我一开始没有注意到它。
I had it like this and removing the outer mat-form-field
fixed it for me:我是这样的,去掉外面的
mat-form-field
为我修复了它:
<mat-form-field>
<mat-form-field>
<mat-label>End Date</mat-label>
<input matInput [(ngModel)]="endDate" #endDate="ngModel" [matDatepicker]="picker1">
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker #picker1></mat-datepicker>
</mat-form-field>
</mat-form-field>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.