I'm trying to access and edit the CSS class of a child component using ::ng-deep
. I have tried different versions of the provided code below but I was unable to access the CSS. The structure of the HTML component is as follows:
This is how I'm trying to access the CSS from the parent component and change the grid-template-columns
property of the class:
::ng-deep{
app-operator-filter{
.header-logos-card{
grid-template-columns: repeat(4,1fr);
}
}
}
What is the correct syntax for achieving this? I'm also open to other suggestions for accessing child components as I've read that ::ng-deep
is not reliable and could be deprecated soon?
This solution to the problem is this:
:host ::ng-deep app-operator-filter{
.header-logos-card {
grid-template-columns: repeat(4,1fr) !important;
}
}
!important was a crucial addition as the changes were being overwritten without it.