I'm trying to figure out how exactly ::ng-deep selector works. How does it omit random nghost and ngcontent attributes names?
Thanks in advance
I'm trying to figure out how exactly ::ng-deep selector works. How does it omit random nghost and ngcontent attributes names?
Thanks in advance
if you use ::ng-deep
in a component where view encapsulation is turned off, it stays there. Since this is invalid CSS, some rules break. It's silent and partial failure because CSS parser simply sees ::ng-deep
as unknown selector.
If we want our component styles to cascade to all child elements of a component, but not to any other element on the page, we can currently do so using by combining the :host
with the ::ng-deep
selector.
:host ::ng-deep h2 {
color: red;
}
FYI: The ::ng-deep
pseudo-class selector also has a couple of aliases: >>>
and /deep/
, and all three are soon to be removed.