I have a component that used ::ng-deep
to style its descendents but I'm trying to implement the answer provided here How to style child components from parent component's CSS file?
My component HTML part looks like this
<span class='icm'>
<button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon fontSet="material-icons-outlined" class="aligned-icon">
more_vert
</mat-icon>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="showOrderHistory(1234)">
Order history
</button>
</mat-menu>
</button>
</span>
My component .scss file looks like this
.icm {
.mat-menu-content:not(:empty){
padding-top: 0px !important;
padding-bottom: 0px !important;
}
.mat-menu-panel {
min-width: 112px !important;
overflow: auto;
-webkit-overflow-scrolling: touch;
border-radius: 4px;
outline: 0;
min-height: unset !important;
}
.mat-menu-item {
font-size: 14px !important;
height: 32px !important;
line-height: 32px !important;
}
}
And the the component.ts has the required line
encapsulation: ViewEncapsulation.None
But the styles are not being applied and I dont want them to be global just applied to any mat-menu that is inside the "icm" span
There is this other very similar question but it does not have accepted answers - How do I style child component from parent's SCSS without ng-deep?
UPDATE