Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular material datepicker doesn't open in modal dialog

I have an angular material 2 date-picker implemented in a bootstrap modal form:

<div class="modal-dialog modal-lg">
  <div class="modal-content">
    <div class="modal-header">
      <h4 class="modal-title">{{title}}</h4>
    </div>
    <div class="modal-body"> 
        <div class="timeline-cal">
            <input class="date-field" [mdDatepicker]="picker" placeholder="Choose a date">
            <md-datepicker-toggle mdSuffix [for]="picker"></md-datepicker-toggle>
            <md-datepicker #picker></md-datepicker>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn grey-btn pull-right"     (click)="cancel()">Cancel</button>
        </div>
    </div>
</div>

However, upon clicking the button, the datepicker wouldn't open in the modal dialog itself but opens in the background. I tried this but didn't help:

.mat-datepicker-content{    z-index: 1200}
like image 706
HBK Avatar asked Sep 07 '17 10:09

HBK


1 Answers

try,

::ng-deep .cdk-overlay-container {
  z-index: 1200 !important;
}

Or this

/deep/ .cdk-overlay-container {
  z-index: 1200 !important;
}
like image 167
JSON Avatar answered Oct 01 '22 20:10

JSON