Consider trying out a similar approach for your solution:
CSS:
::ng-deep .overlay-style-one cdk-overlay-pane {
bottom: 0px !important;
}
::ng-deep .overlay-style-two cdk-overlay-pane {
bottom: 10px !important;
}
HTML:
<mat-form-field>
<mat-select #myselect
[ngClass]="{
'overlay-style-one': myselect.style.bottom = "100px",
'overlay-style-two': myselect.style.bottom < 0,
}"
>
<mat-option>-- EXAMPLE --</mat-option>
<mat-option value="YES">
Yes
</mat-option>
<mat-option value="NO">
No
</mat-option>
</mat-select>
</mat-form-field>
In case you encounter issues with fetching the bottom property using (#local reference), alternative options could be vrender2 or employing an id="XXX" for the matSelect and accessing properties in traditional JavaScript manner:
[ngClass]="{
'overlay-style-one': document.getElementById("XXX").style.bottom < 0,
'overlay-style-two': document.getElementById("XXX").style.bottom >= 0,
}"