I am facing some width issue of mat-date-picker element and the issue is when i use mat-form-field within flex layout for normal inputs, alignments are ok. but when i use same mat-form-field with mat-date-picker, alignments are not ok and i am unable to fix it. any help would be appreciated.
date-picker.html
<div fxFlex="100">
<div fxFlex="40">
<div fxLayout="row" fxLayoutAlign="space-between center">
<div>
<mat-label>COURSE TITLE </mat-label>
</div>
<div>
<mat-form-field appearance="outline">
<input matInput type="text" placeholder="COURSE TITLE" readonly>
</mat-form-field>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center">
<div>
<mat-label>DATE PICKER </mat-label>
</div>
<div>
<mat-form-field appearance="outline">
<input matInput [matDatepicker]="picker" placeholder="CLICK TO OPEN CALENDER">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
</div>
</div>
</div>
</div>
I have googled for this many times but there is no proper solution, if i want to fix this issue i have to do it manually by setting width for dives and its not correct because setting fixed width for dives is not responsive, alignments would be inappropriate.in above code fxLayoutAlign="space-between center" is taking care of alignments of dives.
date-picker.html
<div fxFlex="100">
<div fxFlex="40">
<div fxLayout="row" fxLayoutAlign="space-between center">
<div>
<mat-label>COURSE TITLE </mat-label>
</div>
<div>
<mat-form-field appearance="outline">
<input matInput type="text" placeholder="COURSE TITLE" readonly>
</mat-form-field>
</div>
</div>
<div fxLayout="row" fxLayoutAlign="space-between center">
<div fxFlex="30">
<mat-label>DATE PICKER </mat-label>
</div>
<div fxFlex="40">
<mat-form-field appearance="outline">
<input matInput [matDatepicker]="picker" placeholder="CLICK TO OPEN CALENDER">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
</div>
</div>
</div>
</div>
In above code i have set width using fxFlex for dives, here it works fine but not responsive.its fixed only for laptop and if i open the same UI in dektop or tab alignments going wrong. my question is why mat-form-field width is increasing.i heard like mat-datepicker-toggle is taking some extra space of 1em with mat-form-field link (https://github.com/angular/components/issues/11663).how to fix this and i do not want to do it manually. any help would be appreciated.